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

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

+7
source share
5 answers

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

This key combination will be marked as PrimaryKey selected column (in development mode).

+11
source

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 a column with a primary key constraint .

+2
source

Like this:

ALTER TABLE Persons ADD PRIMARY KEY (P_Id);

then you press CTRL + E

+1
source

Question: what is a shortcut key?

And I do not think that Sql Management Studio has a keyboard shortcut to add a Primary Key to the table. I am also sure that you cannot find a shortcut for the Set primary key menu item.

+1
source

Not 100% sure you can do this, but here is a list of keyboard shortcuts for Sql Server Management Studio.

Perhaps you could create your own .

You can install SSMS Tools and create your own piece of code.

0
source

All Articles