this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Wednesday, March 2, 2011

Get next identity value in my table For SQL Server

It may require some time to know what will be our identity value before we actually insert record in our table. Usually we tend to find our max id value by selecting max id from records. But it may be possible you deleted records and now you want to know next identity value. SQL server has given a very nice function for it.

SELECT IDENT_CURRENT(‘mytable’)

In above line, mytable is table name, in which we want to find next identity value. Very impressive function!!

No comments: