Would be something like shown below if you want to use the output clause. That would be a good solution. In my example, the ID column in the main table can be an identity column if you wish to autogenerate the ID. If you do that you also have the option of using SCOPE_IDENTITY instead of the OUTPUT clauseCREATE TABLE #tmpAuctionMain(id INT, product VARCHAR(32));CREATE TABLE #tmpAuctionDetail(id INT, product_detail VARCHAR(32));INSERT INTO #tmpAuctionMain ( id, product )OUTPUT INSERTED.id, 'abcdDetail' AS detail INTO #tmpAuctionDetail(id, product_detail)VALUES ( 1, 'abcd' ) DROP TABLE #tmpAuctionMain;DROP TABLE #tmpAuctionDetail;