Insert INTO Student(Name,Department) OUTPUT INSERTED.Id INTO @tmpData SELECT * FROM @tmpData // It will give Id's those are inserted into table