June 7, 2007 at 8:13 am
Hi,
How to find initial value of identity column programatically?
I am using DELETE command to delete all the rows in a table and setting the table's identity column to initial value. Problem is, for some of the tables, initial value is not 1.
Thanks,
Ramu
June 7, 2007 at 8:59 am
use the ident_seed function for the table. for example, in the northwind database categories table:
select ident_seed('categories')
this will return 1
hope this helps
June 7, 2007 at 8:06 pm
If you truncate the table identity being reset to initial value automatically.
_____________
Code for TallyGenerator
June 8, 2007 at 1:45 am
Truncate isn't logged so, if you want logging (otherwise just truncate anyway - it's faster), delete first, then truncate.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply