1

I asked this question How to use insert and select simultaneously?

This question clearly asks for getting the id value after a row is inserted and it was closed for duplicate of this question How to extract the last inserted row in SQL Server?

which says When an insert statement is executed one or more rows is inserted into the table, is there any way to extract the last inserted row in SQL Server?

Can anybody please tell me is this really a duplicate?

6
  • 1
    It is a duplicate and I should have searched the site for the duplicate before I answered your question. Jan 13, 2015 at 7:58
  • @MikaelEriksson cool then delete your answer and I will delete my question also.I think its not good to keep duplicate questions Jan 13, 2015 at 8:06
  • You have to unaccept first. It is not possible to delete an accepted answer. Jan 13, 2015 at 8:07
  • 3
  • @MikaelEriksson unaccepted Jan 13, 2015 at 8:16
  • 3
    What @AndriyM said. There's no need to be unaccepting or deleting anything.
    – Paul White Mod
    Jan 13, 2015 at 8:36

1 Answer 1

4

Yes it's a duplicate.

This question clearly asks for getting the id value after a row is inserted

The two main methods for doing this are using SCOPE_IDENTITY and the OUTPUT clause, both of which are described in the accepted answer.

Being closed as a duplicate just means the essence of your question has been asked and answered before.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .