How to use Templates in SQL Server Management Studio (SSMS) - SQL Server / TSQL Tutorial Part 16

Scenario:

I am new developer or been working from long time but my memory is not that great;) every time I need to create an object, I forget the script and I have to go to Google or Microsoft website to get the  template for create, alter object. Does SSMS has something like that so I can use that?


Solution:

SQL Server Management Studio does have built-in templates and you can use them whenever you need them.

Here are the steps how to use Built-in Templates in SSMS.

Step 1:

Go to View Drop down and then choose Template Explorer
How to use Templates in SSMS - SQL Server Tutorial

Template Explorer will open and you will see a lot of templates as you can see some of them in below snapshot.
How to use built-in Templates in SSMS - SQL Server Tutorial Step by Step



Step 2:
Double click on template you would like to use. I clicked on Create Table and below window opened.
How to use Templates in SQL Server Management Studio- SQL Server Training


Step 3:

Now we can replace the existing values in template and change as we like. To provide the values for Template Parameters, Go to Query and then hit Specify Values for Template Parameter as shown below.

How to use Template in SSMS to create Table - SQL Server Tutorial for Beginners

Step 4:

Final step is to provide the values. Once you click Specify Values for Template Parameter, Below windows will open. Go ahead and make changes as per your requirement.

How to use built-in Templates in SSMS - SQL Server/TSQL Tutorial


After providing different parameter values, once you hit Ok. Your query will be ready. I only made change for Database name and Table Name, here is what I get after I hit Ok.


How to Use Templates in SQL Server Management Studio - SQL Server Tutorial

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.