Skip to content

Commit

Permalink
Added SQL renamecolumn snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
codetuner committed Nov 6, 2024
1 parent c36ebe2 commit 599797e
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone" />
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
<CodeSnippet Format="1.0.0">
<Header>
<Title>My Rename Column</Title>
<Shortcut>myrenamecolumn</Shortcut>
<Description>Renames a column.</Description>
<Author>Rudi Breedenraedt</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>
<Literal>
<ID>OldColumnName</ID>
<ToolTip>Original name of the column</ToolTip>
<Default>Old_Column</Default>
</Literal>
<Literal>
<ID>NewColumnName</ID>
<ToolTip>New name of the column</ToolTip>
<Default>New_Column</Default>
</Literal>
</Declarations>
<Code Language="SQL">
<![CDATA[EXEC sp_rename '[$SchemaName$].[$TableName$].[$OldColumnName$]', '$NewColumnName$', 'COLUMN'
GO

$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@ECHO OFF
XCOPY "%~dp0Code Snippets" "%USERPROFILE%\Documents\Visual Studio 2015\Code Snippets" /s /e
XCOPY "%~dp0Code Snippets" "%USERPROFILE%\Documents\SQL Server Management Studio\Code Snippets" /s /e
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone" />
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
<CodeSnippet Format="1.0.0">
<Header>
<Title>My Rename Column</Title>
<Shortcut>myrenamecolumn</Shortcut>
<Description>Renames a column.</Description>
<Author>Rudi Breedenraedt</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>
<Literal>
<ID>OldColumnName</ID>
<ToolTip>Original name of the column</ToolTip>
<Default>Old_Column</Default>
</Literal>
<Literal>
<ID>NewColumnName</ID>
<ToolTip>New name of the column</ToolTip>
<Default>New_Column</Default>
</Literal>
</Declarations>
<Code Language="SQL_SSDT">
<![CDATA[EXEC sp_rename '[$SchemaName$].[$TableName$].[$OldColumnName$]', '$NewColumnName$', 'COLUMN'
GO

$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

0 comments on commit 599797e

Please sign in to comment.