Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSMS 2016 - custom sql code snippet folder vanishes after SSMS restart

Tags:

ssms

I have created a few SQL code snippets, I have imported them to SSMS 2016 in the folder "My Code Snippets". This works fine.

Now I have organized the snippets into folders. I have then successfully added my folder tree to the Code Snippet Manager: enter image description here

and it also is accessible on the Ctrl+K, Ctrl+X menu:

enter image description here

However, as soon as I restart SSMS 2016 this folder is not listed there anymore. (Neither in Code Snippet Manager, nor in the insert menu)

Whereas the snippets added to the My Code Snippets are still there, including the custom folder structure.

It is just a small inconvenience to go through the "My Code Snippets" folder everytime, but I wonder that everything works until a restart of the application.

P.S. Just as I was struggling with getting the code snippets running I want to share this info here. The code snippet manager will import also code snippets with wrong Type in the tag. So the snippet gets then listed in the snippet manager but will not be listed in the Ctrl+K,Ctrl+X snipped menu. Took me quite a while to figure that out.

like image 359
AndyZ Avatar asked Jan 24 '17 10:01

AndyZ


1 Answers

Here is the work around I am using. It works quite well, but you do have to shuffle files around each time you install or upgrade SSMS.

Most of the "as installed" snippets are stored in this folder: C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\SQL\Snippets\1033. The only snippets not in this folder are the "My Code Snippets", which is at C:\Users[UserName]\Documents\Visual Studio 2015\Code Snippets\SQL\My Code Snippets.

Move all sub folders of C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\SQL\Snippets\1033 to a new sub folder. You can call it "Microsoft" or "As Installed".

Restarting SSMS you will note that all those as installed snippets are now gone

With all the "as installed" snippets gone SSMS will now only show snippets from your My Code Snippets folder. SSMS doesn't even show the normal "My Code Snippets" sub folder.

like image 63
Timothy Klenke Avatar answered Dec 12 '22 08:12

Timothy Klenke