I've a stored procedure to insert into multiple tables with foreign key constraint.I created a temp table and populated from there.but my issue here is I just need to insert the newely created ID and another PrimaryKey ID to bridge table.I've bold font on my SP where i need help.The last insert fails. I need to insert newely inserted Parenttableid and Viewid to bridgetable. Code: @Parenttableid uniqueidentifier, @UserId uniqueidentifier; declare @ParenttableData table (id uniqueidentifier); set @UserId =(select UserId from Users where UserName= @Username) BEGIN insert into parenttable( Parenttableid, UserId ) output inserted.Parenttableid into @parentTableData(id) values ( NEWID(), @UserId, ); select @parenttableid = id from @ParenttableData; insert into items( parenttableid, itemsID, ) values ( @parenttableid, NEWID() ); [B]insert into bridgetable (parenttableID,viewId) values[/B] [B] (@parenttableid,@viewID)[/B]