Primary key is a kind of constraint in SQL server .To add the primary key in the existing table , you can do it in two ways.
- Using SQL Management Studio
- Using T-SQL Query
Using SQL Management Studio:
Step1:
Expand the database ,right click the required table and click the design option as shown below.
Step2:
Right click the required column and select the option as set the primary key as shown below.
Primary key is created successfully in StudentDetail table using SQL Management studio.
Step3:
Using T-SQL Query:
No comments:
Post a Comment