Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding columns

Status
Not open for further replies.

foreveryoung

Programmer
Sep 24, 2002
45
GB
I want to add a column to a table and make that the primary key. I am using the following

alter table KH06AdmissionsTBL add column rowid int primary key

what am i doing wrong it said no nulls allowed but if i replace int to autonumber it still wont work.

Any DDL experts out there?

Many thanks
David
 
generally when trying to add a primary key to a DB after they have already been constructed means that you have to remove the relationships made.Watch out though,this might cause some problems so that is just my opinion.Cheers
 
If rows already exist in the table, you can't make the new column the primary key since nulls aren't allowed, and the new column will have some.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top