Hi,I need to do an insert into a table based on a SQL read of an Xml document. The xml document can have multiple nodes which will, of course, translate into multiple rows in my temporary table: select imageId, imageTypeId, notes, editorId, modified into #contentImages from openxml (@idoc, '/content/document/image', 2) -- read elements with ( imageId int, imageTypeId int, notes varchar(1000), editorID int, modified datetime )
The question is, how do I get all the rows of data from #contentImages and insert them into an equivalent number of rows in an actual table? I need to be able to specify the names of the target fields. So, to put it another way, how do I do this:insert into documentimage ( documentId, imageID, version, editorId, modified) select @documentId, imageId, 1, editorId, modified from #contentImages
For multiple rows?Or will that syntax actually do it? Cheers,Matt