Skip to main content

Code Snippets in SQL Server Denali

SQL Server Denali introduced one more feature which can easily and reduces our t-SQL coding. This feature is "Code Snippets".

It allows to insert code template in the query editor. Here is some demonstration of this query editor new feature.



When you clink on Insert Snippets or Ctrl + K, Ctrl + X,



Let's double click on Index and an insert template of Create an Index.


Go ahead, click on Create a non clustered index will generate the index template as following,
CREATE UNIQUE NONCLUSTERED INDEX IX_TableName_Col1
    ON dbo.TableName
    (column_1)

I hope you liked this post. In the next post I will write how to create custom snippet.

Comments

  1. yes, this is nice feature, and looking forward for custom snippet

    ReplyDelete
  2. That's a nice upgrade from having to open a .sql file to cut and paste from. Thanks for highlighting this.

    ReplyDelete
  3. Umm, sounds like what SQL-2008 called Templates, invoked by Ctrl-Alt-T (Template Explorer).

    ReplyDelete
  4. Check out http://www.ssmstoolspack.com/.
    It offers the same and much more.
    And totally free for SQL 2005/2008/2008R2 ...

    ReplyDelete

Post a Comment