Viewing 15 posts - 46 through 60 (of 140 total)
Hi, xquery is just a language that you can use against an xml data type be it a variable or column. You can run it as part of a normal...
July 2, 2013 at 6:37 am
You can use a bit of xquery to transform the data. Here is an example to do that. Assuming the data is loaded into an xml variable called @xml
;with xmlnamespaces...
July 2, 2013 at 1:57 am
I think the main issue that you may have had is the missing namespace declaration in your query. Your example XML has a namespace in there so you need to...
June 15, 2013 at 12:33 pm
I wrote a blog on something similar a while back: http://www.olcot.co.uk/sql-blogs/using-xquery-to-create-a-single-xml-node-with-comma-separated-string-from-multiple-xml-nodes
here is one of a few ways to comma separate the node author for you:
DECLARE @xml XML
SELECT @xml = CONVERT(XML,...
May 31, 2013 at 7:13 am
Hi... Have you tried something like below.. This works fine with your example xml:
DECLARE @xml XML
SELECT @xml = CONVERT(XML, (SELECT * FROM OPENROWSET(BULK N'c:\testxml.xml', SINGLE_BLOB) AS xmldocument), 2)
SELECT t.c.value('(./text())[1]', 'varchar(30)')
FROM...
May 31, 2013 at 2:54 am
Hi, The reason why you are getting that message is because sp_xml_preparedocument does not support a typed xml document. Essentially a typed xml document is one that is bound by...
May 20, 2013 at 1:34 am
rightontarget (5/10/2013)
Thank you very much, it worked for me.What is your blog URL?
Thanks. glad it helped
my blog is syndicated right here at SSC http://www.sqlservercentral.com/blogs/rocks/
May 11, 2013 at 12:56 am
You can store it in a table or a variable and work with it ok. It just depends what you need to do with the XML.. Once you have shredded...
May 10, 2013 at 1:36 am
Mark-101232 (5/8/2013)
Quick 'n dirty solution
SELECT *,
RxReferenceNumber = MyAlias.ConvertedXML.value(N'(/*:Message/*:Body/*:RefillRequest/*:RxReferenceNumber/text()) [1]', 'NVARCHAR(256)')
FROM (SELECT ID,CONVERT(xml,message)As ConvertedXML FROM [surescripts_msg_import]
)MyAlias
Nice one...
May 8, 2013 at 8:54 am
I think you are just missing the namespace reference as part of the XPath... Try this:
--now start shredding the xml
WITH XMLNAMESPACES ('http://www.surescripts.com/messaging' AS sp)
SELECT *,
...
May 8, 2013 at 8:23 am
Personally if I was working with an xml structure like that and had to populate a number of tables, then I would consider shredding it to a single temp table...
April 22, 2013 at 5:32 am
Hi Jim, It's probably me not understanding the data structure or maybe the example XML is missing some elements, but I can't see where all the columns map to the...
April 19, 2013 at 1:26 am
The example XML wasn't well formed so I have had to tweak it to make it valid.. To shred this you would need to use the nodes() function. Here is...
April 18, 2013 at 8:45 am
As Jeff points out, the xml isn't ideal which is true, but I have come up with something that makes a lot of assumptions!. Mainly around the ordering of the...
March 1, 2013 at 8:33 am
Viewing 15 posts - 46 through 60 (of 140 total)