I markøren skal du igen udføre din xml-fil med xml-outputerklæring.
DECLARE @id VARCHAR(25)
declare @loc varchar(25)
set @loc = '/MainItem/SubItem';
declare @query varchar(max)
DECLARE myCursor CURSOR LOCAL FAST_FORWARD FOR
SELECT * FROM @tempcolumnname
OPEN myCursor
FETCH NEXT FROM myCursor INTO @id
WHILE @@FETCH_STATUS = 0
BEGIN
set @query = 'DECLARE @hdoc INT;
EXEC sp_xml_preparedocument @hdoc OUTPUT,'''+ @info+'''
Select Statement
Insert Statement exec (@query)
FETCH NEXT FROM myCursor INTO @id
END
CLOSE myCursor
DEALLOCATE myCursor