Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 primary key

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-27 : 10:45:58
riham writes "I have created a table and inserted values for it in microsoft sql, but I forget to put a pimary key for it. So can you give the way to add a primary key to this table, so I dont delete it and then create it again and I will will be obligated to add many values again.
please try to help me. thankyou"

cristianomaia
Starting Member

4 Posts

Posted - 2004-05-27 : 10:55:42
You can use:

ALTER TABLE :TABLENAME ADD
CONSTRAINT :PKNAME PRIMARY KEY (:KEYFIELD1,:KEYFIELD2...)
GO

You must certify that the key fields are not nulls.
Go to Top of Page
   

- Advertisement -