Solución:
He aquí un ejemplo:
/* Create the stored procedure */
create procedure ParseXML (@InputXML xml)
as
begin
declare @MyTable table (
id int,
value int
)
insert into @MyTable
(id, value)
select Row.id.value('@id','int'), Row.id.value('@value','int')
from @InputXML.nodes('/Rows/Row') as Row(id)
select id, value
from @MyTable
end
go
/* Create the XML Parameter */
declare @XMLParam xml
set @XMLParam = '<Rows>
<Row id="1" value="100" />
<Row id="2" value="200" />
<Row id="3" value="300" />
</Rows>'
/* Call the stored procedure with the XML Parameter */
exec ParseXML @InputXML = @XMLParam
/* Clean up - Drop the procedure */
drop procedure ParseXML
go
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)