I am going to show you , how to add a Foreign Key to a table from an another table in SQL Management Studio.
When you are dealing with the SQL data base with the .Net technologies , it is very easy to handle your SQL data base using the “SQL Management Studio“.
Lets see how can we do this….
Step 1
- Go to the table design of selected DB table.
- then select the attribute which needed to be set as foreign key .
Step 2
- Right click and get the menu, then select the “Relationships” from the menu
- then new window will appear..
Step 3
Click on the [+] button under “Table And Columns Specifications” and then again click on the button which is in right side.
Step 4
- In new window fill needed info related to the FK.
- Select Primary key table and Its Primary Key attribute.
- Select the Foreign Key table and Foreign Key attribute.
Step 5
- Click OK button in current window and then click Close button in next window.
- Now you have set Foreign Key to link tow tables.
- You will see created FK in Keys dialog box also..
Cheers..! :-)
No comments:
Post a Comment