Getting Started with ASP.NET MVC - Part 5: How to do programming with razor syntax
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 113
sqlserver 94
BRH 78
#SQLServer 65
#TSQL 55
SQL Server 32
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2011 7
November 2007 7
November 2011 6
August 2011 6
October 2011 6
July 2011 6
September 2011 6
December 2011 6

Madhivanan's TSQL Blog

Exploring SSMS - Inserting Code snippets for Objects

Feb 29 2012 1:28AM by Madhivanan   

As you know I have started a new series on "Exploring SSMS" by which I will be posting some features that are available in SSMS which will be very helping during the development. In this post we will see how to insert code template for creating a table, stored procedure, login etc in the SQL Server management studio.

In the Tool bar, goto Edit-->IntelliSense-->Insert Snippet. You will get an option for Function, table, stored procedure etc. If you want to create a template for table, select table-->Create table.

The following code will be added in the query window

CREATE TABLE dbo.Sample_Table
(
    column_1 int NOT NULL,
    column_2 int NULL
);

If you want to create a code template for Stored procedure with Output parameter, choose Stored Procedure-->Create procedure with OUTPUT parameter. The following code will be added in the query window

CREATE PROCEDURE dbo.Sample_Procedure 
    @param1 int = 0,
    @param2 int OUTPUT 
AS
    SELECT @param2 = @param2 + @param1 
RETURN 0 

Similarly you can create code templates for other available options.

Other posts that come under Exploring SSMS
Enabling Save Changes
Enable/disable intellisense
Connecting to msdn forums or submitting your feedback to connect
Filtering object names
Changing Top N rows values
Copy results with header
Hiding System databases

Tags: t-sql, sql_server, sqlserver, tsql, SSMS,


Madhivanan
4 · 39% · 8773
3
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • Is it supported in SSMS 2012 only? I tried it in SSMS 2008 R2, but cannot find the "Insert Snippet" option.

    commented on Mar 1 2012 7:29PM  .  Report Abuse This post is not formatted correctly
    kingkong0924
    145 · 1% · 274

Your Comment


Sign Up or Login to post a comment.

"Exploring SSMS - Inserting Code snippets for Objects" rated 5 out of 5 by 3 readers
Exploring SSMS - Inserting Code snippets for Objects , 5.0 out of 5 based on 3 ratings
    Copyright © Beyondrelational.com Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising