DECLARE @idoc int
set @myFields = replace(@myFields, 'my:', '')
print @myFields
EXEC sp_xml_preparedocument @idoc OUTPUT, @myFields
Declare @ID as int
Declare @First varchar(10)
Declare @Last varchar(10)
Declare XMLCursor cursor for SELECT First , Last, ID FROM OPENXML( @idoc, 'myFields/Group1/Group2',1)
WITH ( ID Int 'ID',
First varchar(10) 'First',
Last varchar(10) 'Last'
)
Open XMLCursor
fetch next from XMLCursor
into @First, @Last, @ID
WHILE @@FETCH_STATUS = 0
Begin
insert into exp1 (First, Last, ID) values (@First, @Last, @ID)
fetch next from XMLCursor
into @First, @Last, @ID
end
close XMLCursor
Deallocate XMLCursor
EXEC sp_xml_removedocument @idoc
|