Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is shortcut for setting primary key in SQL Server 2008?

I am creating a table, how can I set primary key for my table without using my mouse ? I wanna do this with my keyboard (short key).

like image 862
A Programmer Avatar asked Dec 05 '11 10:12

A Programmer


People also ask

What is CTRL L in SQL Server?

To find this out, press CTRL+L to display the estimated query execution plan as shown below without actually running the whole query (in fact it runs for top 1 row).


2 Answers

Try with: Alt+L,Y (case insensitive).

That keyboard shortcut will mark as PrimaryKey of selected column (on design mode).

like image 131
Elias Hossain Avatar answered Oct 05 '22 00:10

Elias Hossain


Here is an example:

CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (P_Id)
)

P_Id is the column with the primary key constraint.

like image 23
aF. Avatar answered Oct 05 '22 02:10

aF.