This is a discussion on Forcing an IDENTITY column to have a certain value within the SQL Server forums, part of the Microsoft SQL Server category; --> All, Is there any way to _set_ an IDENTITY column to have a certain value so as to create ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Weyus wrote: > 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. There is also a DBCC command: DBCC CHECKIDENT ('table_name', reseed, new_value) -- Best regards, Marcin Guzowski http://guzowski.info |
| |||
| On Jun 27, 3:28 pm, "Marcin A. Guzowski" <tu_wstaw_moje_i...@guzowski.info> wrote: > Weyus wrote: > > 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. > > There is also a DBCC command: > DBCC CHECKIDENT ('table_name', reseed, new_value) > > -- > Best regards, > Marcin Guzowskihttp://guzowski.info Thanks, That's what I needed! Wes |
| ||||
| If you only need small gaps, you could simply do this: BEGIN TRANSACTION INSERT INTO my_table DEFAULT VALUES ROLLBACK TRANSACTION HTH, Gert-Jan Weyus wrote: > > 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 |