I need to get the next identity value from SQL Server.
SQL Server
I use this code :
SELECT IDENT_CURRENT(\'table_name\') + 1
This
In case when your table will be empty then this query will work perfectly.
SELECT CASE WHEN (SELECT COUNT(1) FROM tablename) = 0 THEN 1 ELSE IDENT_CURRENT('tablename') + 1 END AS Current_Identity;