Hello,
I want to do two sql INSERTS into the same table (table holds pk and fk rows) but I need the second insert to use the new Identity from the first INSERT. Something like:
However this doesn't work! Is this even possible or will I need to split this into 2 seperate calls completly?
Thanks,
Steve
I want to do two sql INSERTS into the same table (table holds pk and fk rows) but I need the second insert to use the new Identity from the first INSERT. Something like:
Code:
INSERT INTO [table] SELECT [Cols] FROM [Table] Where [blah];SELECT NewUDValue AS @@IDENTITY; UNION ALL SELECT [colName = NewUDValue, more cols] FROM [Tablle] Where [Blah]
Thanks,
Steve
Comment