Setting PRIMARY KEY using Alter Table
-
Guys im having a problem with this statement.. ALTER TABLE tblSample ADD SampleField nvarchar (30) NOT NULL CONSTRAINT SampleField PRIMARY KEY im just trying to set my newly added column and at the same time setting it as a primary key.. but it wont work.. Is there any other way? or can it set an existing non primary column to a primary one.. if it can then how.. thanks..
-
Guys im having a problem with this statement.. ALTER TABLE tblSample ADD SampleField nvarchar (30) NOT NULL CONSTRAINT SampleField PRIMARY KEY im just trying to set my newly added column and at the same time setting it as a primary key.. but it wont work.. Is there any other way? or can it set an existing non primary column to a primary one.. if it can then how.. thanks..
-
This should work. What error are you getting? BTW, you should really ask this question in the SQL forum. It has nothing to do with VB. -- modified at 8:16 Friday 12th October, 2007
Paul Marfleet
-
it will not work because in sql u can not add column with Null having a primary key. it will work in access after removing nvarchar->char -- modified at 4:34 Saturday 13th October, 2007