how to retrieve autogenerated id after insert sql code example Example: how to get inserted id in sql server SELECT SCOPE_IDENTITY();