Tip-3: Exciting SSMS features derived from Visual Studio


In this series of posts, we’ll see few great yet less known and under utilized tips/features those are there since earlier versions of Visual Studio and later made their way to SSMS (SQL Server Management Studio). I am sure, you’ll love these tips.
Tip 3: Transact SQL Code Snippet – Insert Code Snippet

 

Have you used code snippet feature in Visual Studio? Aren’t they very useful?

What are code snippets?
Code Snippets are reusable code templates those help to write code faster.

What are Transact SQL code snippets?
“A Transact-SQL code snippet is a template containing the basic structure of a Transact-SQL statement or block. You can use snippets as a starting point when adding statements in the Database Engine Query Editor. You can insert the pre-defined snippets supplied with SQL Server, or create your own.”MSDN

We’ll discuss about how we can create a Transact SQL code snippet of our own on a later blog post. For now, we’ll see how we can use them.

You can do it either way-801800

  • Right click on the query window and click Insert Snippet…
  • Using keyboard shortcuts CTRL+K, CTRL+X802

Then choose the appropriate category and then the appropriate template to insert it in to your query window.

 

Hopefully, you liked this tips. Please stay tuned to learn few more exciting tips in this series. Will love to hear from you. Thanks for reading 🙂

 

Tip-2: Exciting SSMS features derived from Visual Studio


In this series of posts, we’ll see few great yet less known and under utilized tips/features those are there since earlier versions of Visual Studio and later made their way to SSMS (SQL Server Management Studio). I am sure, you’ll love these tips.


Tip 1: Clipboard Ring – Copy Paste rediscovered
Tip 2: Box Selection – Select and Edit text easily

90Have you ever imagined to select a particular portion of the text or rectangular region of the text from multiple rows like the figure -1 ?
Box selection?
Why I need that ? Oh ! Believe me, many times while executing queries for various tests you’ll need it.

Is this really possible?
Sad, with traditional horizontal selection system you can’t do that.

If you are known to Visual Studio 2010 (release: 12 April 2010) or newer environment, probably you already know this. Since Eclipse 3.5 (release: 24 June 2009), this facility is there. If you have SQL Server 2014 (not sure about SQL Server 2012), you have the power to do columnar selection also known as box selection.

box-selectionYou can do it either way-

  • Holding down the ALT key and dragging mouse to select text as we do for normal selection.
  • Using keyboard shortcuts ALT + SHIFT + ARROW KEYS

You can do following actions through Box Selection

  • Copy : Copy rectangular region/box of text
  • Text Insertion: Select the box and start typing to replace the selection with typed in new text on every selected line.
  • Paste:
    • Single Copy – Box Paste: On box selection pasting some text will be applied to every line
    • Box Copy – Box Paste: Paste contents of one box selection to another box selection
    • Box Copy – Single Paste: Little weird though. Check what is happening !
  • Zero-Length boxes: Vertical selection of zero characters wide to create a multi-line insertion point for new or copied text. To do this, just hold down the ALT key and keep pressing down/up key till the length you want.  This will create a multi-line insertion point.

 

Hopefully, you liked this tips. Please stay tuned to learn few more exciting tips in this series. Will love to hear from you. Thanks for reading 🙂

 

Tip-1: Exciting SSMS features derived from Visual Studio


In this series of posts, we’ll see few great yet less known and under utilized tips/features those are there since earlier versions of Visual Studio and later made their way to SSMS (SQL Server Management Studio). I am sure, you’ll love these tips.


Tip 1: Clipboard Ring – Copy Paste rediscovered

How many times it has happened that you have copied some text and before pasting it on the desired position /location, copied another chunk of text and then you realized that you lost the previous copy?
Have you ever wished for a feature which can help you accessing text previously copied to clipboard and which should be as simple as the popular copy paste shortcuts?

If you are using Visual Studio 2010 or newer, probably you already know this. Since SSMS 2012, this feature know as “Clipboard Ring” has been introduced. Either of the following two simple keyboard shortcuts will do the job.

CTRL + SHIFT + V
CTRL + SHIFT + INS

Using these shortcuts you can cycle through the clipboard ring which stores maximum of 20 copy actions.

Hopefully, you liked this tips. Please stay tuned to learn few more exciting tips in this series. Will love to hear from you. Thanks for reading 🙂

 

SQL Server: Convert Text to Upper or Lower Case


ConvertUpperCase

This small post is all about converting the text typed in New Query window in SSMS (SQL Server Management Studio)  to upper and lower case. There is nothing much to write except a keyboard shortcut but, I feel this feature deserves a separate post. This is particularly useful when you are formatting an existing SQL query, Stored Procedure, View, Trigger etc. which is not well formatted earlier.

Here are the shortcuts:
Select the text and

Press CTRL + Shift + U to convert to Upper Case
and
Press CTRL + Shift + L to convert to Lower Case

Hope this helps.
Thanks for reading.