Link to home
Start Free TrialLog in
Avatar of F-J-K
F-J-KFlag for Canada

asked on

How to Auto-Increment Non-Primary Key? - MS SQL Server

CREATE TABLE SupplierQuote
(
      supplierQuoteID   int identity (3504,2) CONSTRAINT supquoteid_pk PRIMARY KEY,
      PONumber            int identity (9553,20) NOT NULL
        .
        .
);

I get this error:

Msg 2744, Level 16, State 2, Line 1
Multiple identity columns specified for table 'SupplierQuote'. Only one identity column per table is allowed.

How can i fix this error?
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of F-J-K

ASKER

@raj

But  PONumber  int (9553,20) won't be auto-incremented, will it?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of F-J-K

ASKER

>>Only 1 Identity per table....you should probably have a different table named PO with the PO number as the identity column.

I think that's fastest way...

I wonder why only one column is allowed to be auto-incremented?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of F-J-K

ASKER

Thanks