sql server get identity value before insert edit button Edit

Murugan Andezuthu Dharmaratnam | calendar 27 November 2020 | 1615

I wanted to know the auto-generated identity value before I do an Insert statement. I have a table named setupcountry and I had set the NumercId column as identity with type integer.


select IDENT_CURRENT('yourtablename')            


Returns the last identity value generated for a specified table. NULL is returned on error or if you do not have permission to view the object