Friday, May 23, 2008

Query XML in SQL-2005

Hi friends lets take one look at new feature of SQL-2005 which Supports Query sql Data like relational database. it is rarly used but powerful feature of database.generally this it is not feasible to use XML as relational database but when you have information in which columns are varies frequently in such situation you can Use such feature. and u might know that SQL-2005 have new datatype called xml datatype. Using power of XQuery and XML datatype we fatch data in Tabular format. Declare @XMLFriends xml set @XMLFriends ='hareshParesh'

Select'.','VARCHAR(200)') as FriendId FROM @XMLFriends.nodes('/User/name') as ParamValues(name) Output of above query is: 1 haresh 2 nirav