Monday, October 31, 2022

How to auto create syntax for triggers, table, functions in SQL Server - How to Create Snippet in SQL server Management Studio

> Right click on SQL Server management studio

> Click on 'Insert  snippet'

> Create a file in "Documents\SQL Server Management Studio\Code Snippets\SQL\My Code Snippets\Create View.snippet" 

Create the below code for select query

===================

<?xml version="1.0" encoding="utf-8" ?>

<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">


<CodeSnippet Format="1.0.0">

<Header>

<Title>Select * From</Title>

        <Shortcut></Shortcut>

<Description>Select * From</Description>

<Author>India Corporation</Author>

<SnippetTypes>

<SnippetType>Expansion</SnippetType>

</SnippetTypes>

</Header>

<Snippet>

<Declarations>

<Literal>

<ID>SchemaName</ID>

<ToolTip>Name of the schema</ToolTip>

<Default>dbo</Default>

</Literal>

<Literal>

<ID>tablename</ID>

<ToolTip>Name of the table</ToolTip>

<Default>Sample_Table</Default>

</Literal>

</Declarations>

<Code Language="SQL">

<![CDATA[


    Select * from $SchemaName$.$tablename$

]]>

</Code>

</Snippet>

</CodeSnippet>

</CodeSnippets>


No comments:

Post a Comment