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