How do I define a column to be a primary key in tsql?

satya - 4/24/2014 1:59:40 PM

How do I define a column to be a primary key in tsql?

How do I define a column to be a primary key in tsql?

Search for: How do I define a column to be a primary key in tsql?

satya - 4/24/2014 2:04:09 PM

tsql identity column and primary key

tsql identity column and primary key

Search for: tsql identity column and primary key

satya - 4/24/2014 2:57:22 PM

You don't need to define the identity column as the primary key

You don't need to define the identity column as the primary key

satya - 4/24/2014 2:57:31 PM

There is only one primary key in a table

There is only one primary key in a table

satya - 4/24/2014 2:57:55 PM

Primary key ensures that each row is unique in a meaningful way

Primary key ensures that each row is unique in a meaningful way

satya - 4/24/2014 2:58:19 PM

Example: the name of an entity may be unique and hence primary

Example: the name of an entity may be unique and hence primary

satya - 4/24/2014 2:58:34 PM

There can be alternate constraints that are unique or every foreign constraints

There can be alternate constraints that are unique or every foreign constraints

satya - 4/24/2014 4:23:01 PM

Here is how you set a primary on a column


right click on table
design
righ click on column row
set primary key

satya - 4/25/2014 11:05:29 AM

Some notes on identity column

for prepopulated data don't use identity column. Instead explicitly populate the identity column.

On the other hand when the entities are created through admin panels then you MAY use the identity column.

Even in case of admin panels the entities are limited in number you may want to consider using names or other explicit keys.

When the entities are large and hence anonymous then identity column may serve better.

Note: I am not an expert in this area.

satya - 5/28/2014 9:44:20 AM

See the notes here for doing i through the code

See the notes here for doing i through the code