Changing the IDENTITY

  • Hello SQLers ...

    Can I use the ALTER TABLE command to change the IDENTITY of a column? For example, I have a column named AUTO and I want to be able to turn ON and OFF this setting.

    Is it even possible?

    Thanks.

  • Sorry .... just to add to the above question .....

    If you go to DESIGN VIEW, you can manually change the IDENTITY of any field (making it an Autonumber) and I want to be able to change this programatically. Most of the time, when I insert data, I would like this column to assign the number automatically, but there are times where I do not want this ... I want to tell the database what number to use when adding entries. Therefore, I need to able to change this when needed. Can this be done?

  • when I do this I usually leave the identity field unchanged and use

    the SET IDENTITY_INSERT command.

     

    you can also use DBCC CHECKIDENT to change the numbering sequence as

    well.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply