SQL Server Question

Soldato
Joined
18 Oct 2002
Posts
9,598
Location
Sunderland
Been out of the loop for far too long on front end coding, and cant for the life of me remember the correct code for what Im looking for either in my head or through searching on Google.

Basically looking to turn off the primary key constraint on a table via SQL to allow me to update a records ID, and then renable it within the same statement.

Its definitely possible as Ive done it before, just cant for the life of me track down the right command.

Thanks

Rob
 
To remove the Primary Key:
Code:
ALTER TABLE Table1 DROP PRIMARY KEY

Add the Primary Key again:
Code:
ALTER TABLE Table1 PRIMARY KEY (Column1)
TrUz
 
Though if its an auto number you'll need to issue an ENABLE IDENTITY INSERT command as well I think

Andy
 
Back
Top Bottom