Sunday 6 July 2014

How to Set unique identifier in SQL

How to Set unique identifier in SQL.
In SQL Open Any database.
Right Click on Tables
Add new table.
Enter Id as first column and int as data type.
Name as second column and nchar as data type.
Now how to set ID as unique identifier.
1) Clear the Allow Nulls check box because you don’t want to allow any null values in this column.
2) Configure the id field as an identity field. To do this, select the id field and then locate the Identity Specification row in the Column Properties pane at the bottom
of the screen. Set the (Is Identity) field to Yes.
3) Ensure that the id row is set to be the primary key. Right click on it and select the Set Primary Key option. You’ll see a small key icon appear beside the id field