Best way to get identity of inserted row?

后端 未结 14 2446
醉梦人生
醉梦人生 2020-11-21 07:06

What is the best way to get IDENTITY of inserted row?

I know about @@IDENTITY and IDENT_CURRENT and SCOPE_IDENTITY

14条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-21 07:43

    After Your Insert Statement you need to add this. And Make sure about the table name where data is inserting.You will get current row no where row affected just now by your insert statement.

    IDENT_CURRENT('tableName')
    

提交回复
热议问题