Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

Can anyone please tell me how for xml clause works behind the scenes like the following query:
SQL
select stuff((select ','+ename from emppck for xml path('')),1,1,'') 

Above one produces resultset as the comma seperated of ename values (1 row).

What exactly is happening behind the scene, what role the database engine has here. Please comment on this.

Regards
Chaithanya M
Posted
Updated 22-Apr-11 5:51am
v2

1 solution

SQL Server 2005 recognizes XML data type columns. The PATH method allows for XPath like expression as a column name. Have a look at both links for more info.

http://msdn.microsoft.com/en-us/library/ms345117%28v=sql.90%29.aspx[^]

http://msdn.microsoft.com/en-us/library/ms345137%28v=sql.90%29.aspx[^]

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900