Changing the PK - I

  • Comments posted to this topic are about the item Changing the PK - I

  • I don't agree with this.  I ran the code in my sandbox and it returned

    Msg 2749, Level 16, State 3, Line 6
    Identity column 'InvoiceID' must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0, unencrypted, and constrained to be nonnullable.

    This, to me, doesn't betoken being unable to remove the identity property, more that you can't change the data type, although none of the options really matches.

  • You'd be wrong. You can change the data type of an identity property column to one of the types in the error. What you cannot do is remove the identity property, so you can't change the data type to an incompatible data type.

  • Ah thank you Steve.  Every day is a school day, particularly for me - my lesson here is to read the actual error message!

    • This reply was modified 1 year ago by  edwardwill.
  • Great question, Steve.  It gave me an idea for something else that I need to do.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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