March 18, 2006 at 6:59 am
I want to reseed an indentity column starting with 0 instead of 1 (as it is currently). But I don't want to change any of the identity column values. In other words, I just want to add this one row with zero and otherwise leave the table untouched. How can I do that?
Sam
March 19, 2006 at 10:14 am
with set identity insert
* a thread working with identity*
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=265998
March 20, 2006 at 10:24 am
Do:
<code>
SET IDENTITY_INSERT MyTable ON
GO
INSERT INTO MyTable (IdCol, Col1, Col2) VALUES (0, 'value1', 'value2')
GO
SET IDENTITY_INSERT MyTable OFF
GO
</code>
You probably don't want to reseed the table completly, as this will end up with identity violations as the identity column counts up and eventually runs into existing ID's.
March 20, 2006 at 10:47 am
Thanks. That did it.
Sam
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply