Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 xml value method

Author  Topic 

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2012-09-14 : 14:47:54
How do i get the result:

Rose
Cosma
Alex
Sunny
Louis
White


select profileProperty.value,
profileProperty.value.value('(//string/@value)[1]', 'VARCHAR(15)')
from @profileProperty profileProperty





declare @profileProperty table(UserID int, PropertyID int, Value xml)


insert @profileProperty (userid, PropertyID, Value)
select 3, 2, '<string>Rose</string>' union all
select 3, 3, '<string>Cosma</string>' union all
select 1, 2, '<string>Alex</string>' union all
select 1, 3, '<string>Sunny</string>' union all
select 2, 2, '<string>Louis</string>' union all
select 2, 3, '<string>White</string>'

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-09-14 : 15:32:14
Dupe: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=178867
Go to Top of Page
   

- Advertisement -