Hi all,
How can you add a primary key to an existing table?
The structure is like this:
CREATE TABLE [dbo].[TEST1] (
[ID] [int] NULL ,
[NAME] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
)
Now I need to modify the test1 table so that ID column will be the Primary key? Also how can you alter the table to add the FK?
Any sample script will be of help as I don't have a sql server book.
Thanks!
How can you add a primary key to an existing table?
The structure is like this:
CREATE TABLE [dbo].[TEST1] (
[ID] [int] NULL ,
[NAME] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
)
Now I need to modify the test1 table so that ID column will be the Primary key? Also how can you alter the table to add the FK?
Any sample script will be of help as I don't have a sql server book.
Thanks!