Red-Gate SQL Prompt is a plugin for SQL Server Management Studio that makes the developers life easier when writing t-sql. It provides improved intellisense, indent and coding styles, and also a snippet manager feature that allows the developer to create a set of useful shortcuts. Those autocomplete items can be really useful for a team, let’s see how we can share them in a team.
Here is an example (CREATE TABLE snippet):
For further information about the product, click here.
From a team perspective it could be important to share those files between developers. Suppose to have some database dedicated snippets, for example templates on roles, users, index options and so on. In those cases we can create snippets as described below:
That DEMO snippet will be added onto the default list.
How can we share the new item to the team? Following the steps I made:
- dropbox installed
- folder content copied into dropbox
- SQL Prompt default folder changed
I made the copies and changes with powershell.
1) dropbox folder
After dropbox is installed, create a folder that will contain snippets and that will be shared. The name in this example will be “Snippets”. Share the folder with other developers.
2) powershell script
#specify the sql prompt folder (registry) $SQLpromptFolder = "SQL Prompt 5" #copies the snippet files into the dropboxfolder $localAppDataSnippets = $env:LOCALAPPDATA + "\Red Gate\" + $SQLpromptFolder + "\Snippets\*.sqlpromptsnippet" $newSnippetFolder = $env:USERPROFILE + "\Dropbox\Snippets" Write-Host "Copying *.sqlpromptsnippet files from " + $localAppDataSnippets + " to " + $newSnippetFolder + ".." Copy-Item $localAppDataSnippets $newSnippetFolder #registry property $SQLpromptRegistryFolder = "HKCU:\Software\Red Gate\" + $SQLpromptFolder Set-Location $SQLpromptRegistryFolder Set-ItemProperty . "Snippets Folder" $newSnippetFolder Write-Host "Restart SQL Server Management Studio to apply.."
2 thoughts on “Share t-sql snippets to the team with SQL Prompt”
You can also access a publically available cache of snippets here: https://github.com/gvohra/sqlpromptsnippets
Feel free to clone and contribute to this repo, or fork from it for your own teams.
Thank you for this repo!