|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, November 01, 2012 1:18 PM
Points: 110,
Visits: 261
|
|
You can just cast the nvarchar column to xml, but this obviously incurs the overhead of parsing the content and would error out if the column contains invalid xml.
use tempdb; create table t (i int, x nvarchar(100)); insert t values (1, '<abc>def</abc>'); go select i, cast(x as xml) from t for xml auto go
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Saturday, May 11, 2013 8:17 AM
Points: 460,
Visits: 2,521
|
|
Do you have an example that shows your specific problem? I will try to help you out then.
.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 4:47 PM
Points: 93,
Visits: 501
|
|
Very concise article. I spent a couple days figuring this out. Why is there nothing in BOL as simple as this? You might note that to assign the results of the xml-generating query to a variable declared as XML, you need to surround the query in parentheses. declare @xmlparm xml select @xmlparm = (select orderid from order for xml auto, type)
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, February 21, 2013 1:07 PM
Points: 32,
Visits: 50
|
|
OH MY GIDDY AUNT!!! This article is HUGE!! Resultset > .NET Serialization > direct Object usage You can autopopulate an objects list properties with a deserializing use of the resultset. Have a CurrentOrder object? Derialize the resultset in to it. I realize I make it sound simple, but if you are creating a system or can fit in some design tweaks/adjustments to the system, then the ability to autopopulate an Order object directly from a result set without need to 'read' the result and load the properies manually? THAT'S HUGE !!
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, June 30, 2010 7:31 AM
Points: 8,
Visits: 7
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, May 29, 2007 9:00 PM
Points: 7,
Visits: 1
|
|
thanks for a well balanced document that gives concise information and syntax to a required information subject
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, January 22, 2009 2:49 AM
Points: 4,
Visits: 5
|
|
Its very straightforward. also very practicle. keep it up......!!!  thanks
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: 2 days ago @ 10:17 AM
Points: 91,
Visits: 174
|
|
That's great. It helped me out a lot. Does anyone have any info/styles/code/opinions on how to retrieve on the other end? Specifically how to parse this file into variables in VB.Net?
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Saturday, March 30, 2013 1:08 PM
Points: 1,
Visits: 11
|
|
| Excellent Job! Very easy to follow!
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 7:35 AM
Points: 201,
Visits: 211
|
|
Nice article.
Has anyone got any examples of similar XML output but with header information included.
Following on from Jacobs article and presuming the existence of an OrderHeader table, the output would look something like attached
Ta
|
|
|
|