SSMS Tips and Tweaks – Keyboard shortcuts

After some time just saving drafts here (I have a lot of unpublished content right now), I wanted to share some tips to make your life easier when working inside SSMS. The first tip is about keyboard shortcuts.

on SSMS hit Tools, then Options and choose Environment-Keyboard. Enter the queries you want to run with any key combination in there. Here are my queries for example:

--ctrl+f1
sp_helptext

--ctrl+3
select * from 

--ctrl+4 (view all tables of base, with row counts)
SELECT '[' + SCHEMA_NAME(t.schema_id) + '].[' + t.name + ']' AS fulltable_name, SCHEMA_NAME(t.schema_id) AS schema_name, t.name AS table_name, i.rows FROM sys.tables AS t INNER JOIN sys.sysindexes AS i ON t.object_id = i.id AND i.indid < 2 order by rows desc

--ctrl+5 (functions, procedures, views)
SELECT  SCHEMA_NAME(schema_id) AS schema_name ,name AS obj ,type_desc as tipo ,null as ViewIsIndexed ,null as ViewIsIndexable FROM sys.objects WHERE type_desc like '%_PROCEDURE' or type_desc like '%_FUNCTION' union all SELECT SCHEMA_NAME(schema_id) AS schema_name ,name AS obj ,type_desc as tipo ,OBJECTPROPERTYEX(OBJECT_ID,'IsIndexed') AS IsIndexed ,OBJECTPROPERTYEX(OBJECT_ID,'IsIndexable') AS IsIndexable FROM sys.views order by tipo, obj

--ctrl+8
 sp_spaceused 
 
--ctrl+9 (view objects containing text inside database. select "text%'" to use)
SELECT OBJECT_NAME(OBJECT_ID) object FROM sys.sql_modules WHERE definition LIKE '%

'--ctrl+0
select count (*) from 

cya!

Advertisements

About mauriciorpp

Hi, I am Piccolo - but not the one from Dragon Ball. I'm from a highly competitive and fast-paced world too, the IT industry, and this space will be used to share some challenges I face daily on my career. As you will see, I don't do brawls but I need to be a fighter! Stay tuned.
This entry was posted in SQLServer and tagged , . Bookmark the permalink.

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