Welcome to MSDN Blogs Sign in | Join | Help
TSQL XML query

I write my first TSQL XML query a long time ago, and I repeatedly run into the same problem every year. What is the syntax? 

 Let assume I am going to store my whole employee table in one giant XML and store it in the employee table with one row and one column,  here is the syntax to use XML.

SELECT T.c.value('@name', 'varchar(256)') AS [name]

FROM Employee

CROSS APPLY Sources.nodes('/Company/Department/Employees') AS T(c)

Hopefully, next time when I run into the same problem again, I don't need to search for TSQL syntax again.

Posted: Wednesday, February 04, 2009 8:00 PM by TikiWan
New Comments to this post are disabled
Page view tracker