All,
I have the following code:
--xml is already declared and populated with an xml document
SELECT
ent.query('TradeId').value('.','VARCHAR(10)') TradeId
FROM
@xml.nodes('//table/trade[1]') Col(ent)
How can I have the expression //table/trade[1] as a variable so I can increase the [1] in a loop ? For example I would like something like the below which is not working:
DECLARE @KLM varchar(100)
SET @KLM= '//table/trade[1]'
SELECT
ent.query('TradeId').value('.','VARCHAR(10)') TradeId
FROM
@xml.nodes(@KLM) Col(ent)
Any ideas?
Thanks,
M