how to have plus minus function on identity columns

  • how to have plus minus function on identity columns

  • What do you mean exactly ?

  • You can have the identity column increment up, or down, but not both at the same time. To have it increment to negative numbers, set the increment value as -1 when you define the column.

    You can insert negative numbers into a table with an identity column, even if that column is incrementing up, just SET IDENTITY_INSERT tablename ON. You can only have that turned on at one table in a db at a time. Turn it back off using SET IDENTITY_INSERT tablename OFF.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • friendsuseonly (1/9/2012)


    how to have plus minus function on identity columns

    Definitely need more information on your actual NEED here to be able to guide you effectively.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

Viewing 5 posts - 1 through 4 (of 4 total)

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