Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

Advanced XML Processing Expand / Collapse
Author
Message
Posted Wednesday, May 9, 2007 8:26 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, November 1, 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
Post #364395
Posted Wednesday, May 9, 2007 8:55 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:42 AM
Points: 460, Visits: 2,523

Do you have an example that shows your specific problem? I will try to help you out then.



.
Post #364413
Posted Wednesday, May 9, 2007 10:28 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Yesterday @ 10:36 AM
Points: 95, Visits: 577

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)

Post #364461
Posted Wednesday, May 9, 2007 10:36 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC 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 !!

Post #364466
Posted Thursday, May 10, 2007 8:05 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 30, 2010 7:31 AM
Points: 8, Visits: 7
nice and simple
Post #364968
Posted Monday, May 14, 2007 11:14 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Post #365840
Posted Thursday, May 17, 2007 9:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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

Post #366857
Posted Tuesday, June 26, 2007 7:22 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, October 20, 2014 11:24 AM
Points: 94, Visits: 211

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?

 




Post #376640
Posted Wednesday, August 8, 2007 9:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, March 30, 2013 1:08 PM
Points: 1, Visits: 11
Excellent Job! Very easy to follow!
Post #388947
Posted Thursday, October 25, 2007 9:17 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 25, 2014 3:04 AM
Points: 205, Visits: 219
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


  Post Attachments 
order.txt (13 views, 499 bytes)
Post #415014
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse