We have to write below query:-
SELECT IDENT_CURRENT('table_name') + 1
This is correct, but when table is empty and next identity value is set to "1"
but result is "1"
When the IDENT_CURRENT value is NULL because the table has never contained rows or has been truncated,the IDENT_CURRENT function returns the seed value.
Asked In: Many Interviews |