I've read through SO: XML data type method “value” must be a string literal but my problem's a bit different. I have a bit of xml in a variable I want to pick apart and am given a path. originally I tried this:
declare @x xml
select @x = '....'
select @x.value('(' + @path + ')[1]', 'varchar(max)')
but, of course, that fails. then I found the sql:variable and tried this:
select @x.value('(sql:variable("@path"))[1]', 'varchar(max)')
but that curiously returns the value of @path (why?). I've been messing with it but can't get it to do the right thing.
Thoughts anyone?