Well the answer is simple use OUTPUT clause with your INSERT statement and you should be able to achieve it.
Given below is the example
-- First Table in which we will INSERT data
DECLARE @TAB TABLE
(
NUM INT IDENTITY(50,1),
ID INT
)
-- Second table to hold the indentity value from the first table
-- This table will be populated using OUTPUT clause
DECLARE @TAB1 TABLE
(
ID1 INT
)
Given below is the example
-- First Table in which we will INSERT data
DECLARE @TAB TABLE
(
NUM INT IDENTITY(50,1),
ID INT
)
-- Second table to hold the indentity value from the first table
-- This table will be populated using OUTPUT clause
DECLARE @TAB1 TABLE
(
ID1 INT
)