all groups > sql server (alternate) > june 2007 >
You're in the

sql server (alternate)

group:

Forcing an IDENTITY column to have a certain value


Forcing an IDENTITY column to have a certain value Weyus
6/27/2007 8:11:50 PM
sql server (alternate):
All,

Is there any way to _set_ an IDENTITY column to have a certain value
so as to create a gap in the set of identity values on purpose?


All I've found is SET IDENTITY_INSERT.

Thanks,
Wes
Re: Forcing an IDENTITY column to have a certain value Weyus
6/27/2007 9:02:19 PM
On Jun 27, 3:28 pm, "Marcin A. Guzowski"
[quoted text, click to view]

Thanks,
That's what I needed!

Wes
Re: Forcing an IDENTITY column to have a certain value Marcin A. Guzowski
6/27/2007 10:28:51 PM
[quoted text, click to view]

There is also a DBCC command:
DBCC CHECKIDENT ('table_name', reseed, new_value)


--
Best regards,
Marcin Guzowski
Re: Forcing an IDENTITY column to have a certain value Gert-Jan Strik
6/28/2007 9:31:37 PM
If you only need small gaps, you could simply do this:

BEGIN TRANSACTION

INSERT INTO my_table DEFAULT VALUES

ROLLBACK TRANSACTION


HTH,
Gert-Jan


[quoted text, click to view]
AddThis Social Bookmark Button