Reputation: 371
Microsoft SQL Server 2008 - Version 10.0.6556.0
;WITH dataAsXml AS
(
SELECT
xmlData.myElement.value('@myAttribute1', 'varchar(10)') AS 'myAttribute1',
xmlData.myElement.value('@myAttribute2', 'char(5)') AS 'myAttribute2'
FROM
@input.nodes('/myRootElement/childElement') AS xmlData(myElement)
)
INSERT INTO myTable (myCol1, myCol2)
SELECT myAttribute1, myAttribute2 FROM dataAsXml
The above xQuery doesn't seem to work from within a stored procedure. The data is definitely there but nothing is inserted into myTable. It works from query window but if the same thing is put inside a stored procedure, nothing seems to happen
<?xml version="1.0" encoding="UTF-8"?>
<myRootElement>
<childElement myAttribute1="Value1" myAttribute2="value2"/>
</myRootElement>
Upvotes: 0
Views: 46