Problem with parsing SQL into table variable
- by Stanley Ross
I'm using the following code to read a SQL XML Variable into a table variable. I am getting the following error. " Incorrect syntax near '.'. " Can't quite Figure it out
DECLARE @LOBS Table
(
LineGUID varchar(40)
)
DECLARE @lg xml
SET @lg = '<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<Table>
<LOB>
<LineGuid>d6e3adad-8c53-4768-91a3-745c0dae0e08</LineGuid>
</LOB>
<LOB>
<LineGuid>4406db8f-0d19-47da-953b-afc1db38b124</LineGuid>
</LOB>
</Table>'
INSERT INTO @LOBS(LineGUID)
SELECT ParamValues.ID.value('.','VARCHAR(40)')
FROM @lg.nodes('/Table/LOB/LineGuid') AS ParamValues(ID)