The problem is that in order to really use the output clause to capture the identity column, and then subsequently use it in a child insert, you do need something to be able to tie it back to.
You mentioned NewID()... what's the chances that you have a rowguid column in the tblParent table?
I do like the idea of using the NewID()... I would do it like this:
DECLARE @tbl TABLE (
pkSourceId int IDENTITY(1,1),
field1 int,
childval1 varchar(3),
childval2 varchar(3),
InsertedId bigint,
RowID uniqueidentifier NOT NULL UNIQUE DEFAULT NewID());
INSERT INTO @tbl (field1, childval1, childval2)
VALUES (10,'123', 'ABC')
INSERT INTO @tbl (field1, childval1, childval2)
VALUES (20,'234', 'DEF')
INSERT INTO @tbl (field1, childval1, childval2)
VALUES (30,'345', 'GHI')
INSERT INTO @tbl (field1, childval1, childval2)
VALUES (40,'456', 'JKL')
select * from @tbl
Though I'm sure someone else will come along with a better idea... (is someone out there listening???)
Another thought... is all the data in a row unique? If so, you could output and match on all of the columns.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes