sqlserver 读取xml 字符串方法
时间:2015-09-09 16:40:20
收藏:0
阅读:320
declare @xml xml
declare @propertyName varchar(50)
declare @str nvarchar(max)
set @propertyName = ‘s_Code‘
set @xml = ‘<root> <row propertyName="s_Code">test</row><row propertyName="s_Posword">admin</row></root>‘
SELECT @str =@xml.value(‘(/root/row[@propertyName=sql:variable("@propertyName")])[1]‘, ‘nvarchar(max)‘)
select @str
declare @xml xml
declare @propertyName varchar(50)
declare @str nvarchar(max)
set @propertyName = ‘s_Posword‘
set @xml = ‘<root> <row propertyName="s_Code">test</row><row propertyName="s_Posword">admin</row></root>‘
SELECT @str =@xml.value(‘(/root/row[@propertyName=sql:variable("@propertyName")])[1]‘, ‘nvarchar(max)‘)
select @str
原文:http://www.cnblogs.com/szlixin/p/4794939.html
评论(0)