views:

22

answers:

1

I would like to perform a SQL XML insert (on MSSQL), and in this case I need to insert a list of files into the DB (this is simple enough). However, there's an auto generated PK column (ID), and I need the ID for each newly created filename without performing a 2nd query. Is this possible? I guess it doesn't matter if the result is/isn't XML, but the input certainly has to be.

A: 

To answer my own question... I think a possible solution (as one transaction) would be to do a SQL-XML insert as normal. Then, select all rows in the table, and left join against the data in the "to insert" XML data, where the join column is filename... This should return the IDs for all rows that have just been inserted.

nbolton