sqlxml

Invalid character value for cast specification

痴心易碎 提交于 2019-12-11 03:39:56
问题 I am inserting data into SQL 2005 using SQLXMLBulkLoad.SQLXMLBulkload.3.0 My data table has following column: objDataTable.Columns.Add("TaskDateTime", System.Type.GetType("System.DateTime")) My bulk insert schema has following definition: <xsd:element name="DepartureTime" type="xsd:date" /> (Using xmlns:xsd="http://www.w3.org/2001/XMLSchema") And I am getting 'Invalid character value for cast specification' exception. Any advice? 回答1: Solved!. Changed column type from: objDataTable.Columns

xsd schema file must be annotated in SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class?

删除回忆录丶 提交于 2019-12-11 03:32:15
问题 Here is an example to use SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class - [STAThread] static void Main(string[] args) { try { SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class(); objBL.ConnectionString = "Provider=sqloledb;server=server;database=databaseName;integrated security=SSPI"; objBL.ErrorLogFile = "error.xml"; objBL.KeepIdentity = false; objBL.Execute ("schema.xml","data.xml"); } catch(Exception e) { Console.WriteLine(e.ToString()); } } It seems that

parsing xml using sql server

℡╲_俬逩灬. 提交于 2019-12-11 02:36:00
问题 Needed some help to parse text in Paragraph element in following XML in SQL server. <FlowDocument PagePadding="5,5,5,5" Name="RTDocument" AllowDrop="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Paragraph>Licence Number: 04467</Paragraph> <Paragraph>Licence Number: 3535333</Paragraph> </FlowDocument> Please share any queries you may have. Thank you 回答1: One way of doing this is: (If they have the same namespace) ;with xmlnamespaces(default 'schemas.microsoft.com

how to COPY Attribute value in a new attribute

时光毁灭记忆、已成空白 提交于 2019-12-11 02:33:45
问题 How to copy data of attribute to new attribute in the same column in sql original data <root> <child attr='hello'></child> </root> Result 1 <root> <child attr='hello' attr2='hello'></child> </root> Result 2(with a modification) <root> <child attr='hello' attr2='**H**ello **W**orld'></child> </root> I want to do this only through SQL XML Xquery 回答1: I'm not sure I follow what you're wanting exactly in the second result, but I'll take a stab at it: the first example below would produce your

SQLXML on Azure Web sites

≯℡__Kan透↙ 提交于 2019-12-11 02:29:40
问题 My application is using the library SqlXML and I am trying to publish this application to Azure Web Services. Once I publish it I get this error: Retrieving the COM class factory for component with CLSID {83D0FC3E-8B31-4B35-A1B2-346BA3954514} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). I checked stacktracing and its on a method that uses the SqlXML. I checked if the dll is referenced as an assembly in web.config

add column value to an xml field as an attribute

随声附和 提交于 2019-12-11 00:43:22
问题 I would like to add an attribute value to an xml field in a query. my example is below declare @table table (bookid int,xmlCol xml) insert into @table select 1, '<book title="you are not alone" author="Esther"> <EDITIONS> <edition year="2012"/> <edition year="2013"/> </EDITIONS> </book>' declare @table1 table(bookid int,quantity int) insert into @table1 select 1,3 select ??? from @table t inner join @table1 t1 on t.bookid = t1.bookid I want my final result to look like this <book title="you

Oracle SQL XML Functions - How to get encoding in XML Prolog?

╄→гoц情女王★ 提交于 2019-12-10 18:20:20
问题 This SQL SELECT XMLRoot(XMLType('<poid>143598</poid>'), VERSION '1.0', STANDALONE YES) AS xmlroot FROM DUAL; generates an output as follows XMLROOT -------------------------------------- <?xml version="1.0" standalone="yes"?> <poid>143598</poid> How can get encoding in my xml prolog? Ex - I want output to be something like XMLROOT -------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <poid>143598</poid> Reference - Generate XML Data from the database 回答1: select

SQL XML Xquery data query using a variable in the node selection?

我只是一个虾纸丫 提交于 2019-12-10 10:52:50
问题 I am obviously missing something right in front of me, however I have this SQL 2008 XML query as follows: select distinct cast(customFields_xml.query('data(/root/cf_item_type)') as varchar) as c1 from designs .. what I am actually trying to achieve is to make the "cf_item_type" a variable, because I want to pass in the node as a param to a proc.. So in reality, I am trying to end up with something like: (@cf would be passed as a param, but declaring for example use) declare @cf varchar set

How to pass nvarchar (non-English) to CLR (C#) stored procedure?

空扰寡人 提交于 2019-12-09 06:08:28
Working in Visual Studio, I'm trying to pass an entire row to a CLR stored procedure using FOR XML RAW and a parameter of type SqlXml in C# code (with the intent of processing the row using XmlReader). The row contains nvarchar fields. Everything works correctly when the nvarchar fields contain English/numeric/simple punctuation text, but when any of them contain Hebrew or Russian characters, these characters are turned into question marks. (The same for Russian-only text so not an RTL issue) From prints in SQL code I've found that the xml created by XML RAW preserves the non-English

How to pass nvarchar (non-English) to CLR (C#) stored procedure?

喜夏-厌秋 提交于 2019-12-08 06:51:42
问题 Working in Visual Studio, I'm trying to pass an entire row to a CLR stored procedure using FOR XML RAW and a parameter of type SqlXml in C# code (with the intent of processing the row using XmlReader). The row contains nvarchar fields. Everything works correctly when the nvarchar fields contain English/numeric/simple punctuation text, but when any of them contain Hebrew or Russian characters, these characters are turned into question marks. (The same for Russian-only text so not an RTL issue)