SQL Server > Table

Multiple Primary key in SQL Server

How to set more than one columns of the table as Primary key in SQL Server database?


Yes, it is possible to create primary key on combination of columns on the table, to do that select columns to create primary key on by selecting the first column in the design mode by clicking on the left most box and hold the ctrl key (on keyboard) and clicking on the 2nd column in left most box.

This creates primary key on both columns and notify it by keeping the key symbol for both columns. After that do not forget to save the Table by clicking on the Save icon on the toolbar or from File menu.

 Views: 2290 | Post Order: 16



Write for us