Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Reseed Identitity column

Author  Topic 

veggiop
Starting Member

10 Posts

Posted - 2011-04-13 : 05:52:54
First of all Hello to all my experts,
I am having a table 'TB_Bill' in that i have taken an identity column (bill_no)..
but for some reason i need to delete random row from this table..
for eg [Sad] bill_no is identity column)
TB_bill record like this..
bill_no Product_code Pro_desc
1 P_034 Prod. description1
2 P_023 Prod. description2
3 P_025 Prod. description3
4 P_028 Prod. description4

and for some reason i need to delete row where bill_no=3
now i want to set identity column new number to 3 that means when i insert new row in it..this would be
store with new bill_no=3...

so is there any way to do this..send some sql statement or any suggession..

Thanks to all in advance ...

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-13 : 08:01:01
There is no (easy) way to do that and there is no need to do that.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2011-04-13 : 08:38:27
I agree with WebFred... no reason to reset the seed.

If for some reason, you absolutely have to insert a record in with the id #3... you could look into "Set Identity_Insert" statement in SQL help.

Corey

I Has Returned!!
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-04-13 : 08:38:57
Asked and partially answered: http://www.sqlservercentral.com/Forums/Topic1092563-149-1.aspx

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -