SSMS TSQL Short Cuts

Posted: May 3, 2012 in SSMS
Tags:

SSMS allows you to create your own shortcut keys:
Under the Menu Tools Select Options
Under Environment >> Keyboard there is a list of shortcut commands.
A Couple are pre-populated Alt_F1 sp_help; Ctrl+1 sp_who; Ctrl+2 sp_lock;
I have added the following

ctrl+F1 master..xp_fixedDrives;
Shows how much space is available on the fixed drives

Ctrl+3 Select * from sys.databases;
Lists all databases

Ctrl+4 SELECT name AS ‘File Name’ , physical_name AS ‘Physical Name’, size/128 AS ‘Total Size in MB’, size/128.0 – CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128.0 AS ‘Available Space In MB’ FROM sys.database_files;
Shows how much space is available in SQL Data files – uses the context of the current database.

Ctrl+5 DBCC SQLPERF(logspace);
Shows TLog sizes and space used.

Ctrl+6 dbcc Loginfo();
Each row represents a Virtual Log File.

Ctrl+7 Exec xp_msver;
Details server edition etc

Ctrl-8 SELECT database_name, backup_start_date, name, [description], [user_name], [type] FROM msdb.dbo.backupset where type != ‘l’ order by backup_start_date desc; Show backup history (not TLogs)

Ctrl+0 EXECUTE xp_instance_regRead N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’BackupDirectory’; EXECUTE xp_instance_regRead N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’defaultData’; EXECUTE xp_instance_regRead N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’defaultLog’;
Shows the default file locations for Data, Logs, and Backups

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s