Management Studio default file save location

Sql ServerSsms

Sql Server Problem Overview


Open a new query window. Write some SQL. Save the script, the Save File As dialog box opens - but always to the same default location in the Profiles directory. Is there any way to set my default file location? ...Like I used to do with apps from the 1980s?

Under Tools|Options a default location can be specified for query results. I need the same thing for new queries (the text editor). Tried changing locations in the Registry but SSMS just overwrote my changes. Any suggestions?

(I saw this unanswered question at http://www.eggheadcafe.com/software/aspnet/30098335/management-studio-default.aspx and I had same exact question so I just reposted it here)

Sql Server Solutions


Solution 1 - Sql Server

This is 5 years old now, but it doesn't mention SSMS version, so I thought I'd add an update for SSMS 2012 and SSMS 2014. Step one differs between the versions, and then the rest is the same:

SSMS 2012

  1. Locate C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Extensions\Application

SSMS 2014

  1. Locate C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Extensions\Application

SSMS 2016

  1. Locate C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Extensions\Application

SSMS 17

  1. Locate C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Extensions\Application

SSMS 18

  1. Locate C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Extensions\Application

All (continued)

  1. Open ssms.application.pkgdef with text editor(e.g. Notepad)
  2. Change the value of DefaultProjectsLocation "DefaultProjectsLocation"="$MyDocuments$\SQL Server Management Studio"
  3. For query storage location (query itself, not results), edit this: "DefaultUserFilesFolderRoot"="SQL Server Management Studio"
  4. Save the file

Thanks to this source: http://www.networksteve.com/forum/topic.php/How_to_change_the_default_query_save_location_in_SSMS/?TopicId=41425&Posts=0

Solution 2 - Sql Server

I know this is an old question, but I found a link expaining how to do this properly, at least for SQL 2005. Think it will work for later versions as well.

Changing the my projects folder

> The settings are stored in an .vssettings XML file in My Documents\SQL > Server Management Studio\Settings folder. Make sure you close SSMS > before making changes to this file: SSMS writes to it when you close > the application and will overwrite any changes you make. To change the > My Projects folder, you are looking for this line:

   <PropertyValue name="ProjectsLocation">%vsspv_user_documents%\My
   Projects</PropertyValue>

> The value inside is the location of the My Projects folder. Simply > change the value, and the next time you open SSMS the My Projects > folder will be mapped.

Solution 3 - Sql Server

A simple work around is to create a shortcut to your desired save location. Place the shortcut in the SSMS\Projects directory. When saving, select "All Files (.)" at the bottom, then double click your shortcut.

Not ideal, but a quick and simple work around.

Solution 4 - Sql Server

Just to make sure, did you update the locations in the registry here:

HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell

HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\General\ProjectLocationEntries

Solution 5 - Sql Server

The installation location for SSMS 18 has changed, along with the location of the configuration file that controls the default file save location. The file that needs to be edited is now located at the following path:

C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Extensions\Application\ssms.Application.pkgdef

  1. Close all running instances of SSMS 18.

  2. Open ssms.Application.pkgdef with a text editor running with Administrator privileges.

  3. Change the value of DefaultProjectsLocation to what you'd like the default to be:

  • "DefaultProjectsLocation"="C:\My\Preferred\Save\Location"
  1. Save the file and restart SSMS.

Solution 6 - Sql Server

As a workaround, you could create new Project of type SQLServerScripts at the location you wish to store the scripts.

Then in the solution explorer just right click the queries folder to create a new script at the location you have specified.

Make sense?

Fore more detailed about Projects and solutions in SQL Server see:

http://msdn.microsoft.com/en-us/library/ms173803.aspx

Cheers,

Solution 7 - Sql Server

An alternative may be to create an NTFS Junction Point.

Grab a copy of the [Systinternals Suite][1], you need the junction.exe from it, and the other stuff is useful.

Run this in the command line:

junction.exe "c:\MyStuff" "c:\Documents and Settings\Stephen.Turner\My Documents\SQL Server Management Studio"

Putting in your My Documents path.

The directory c:\MyStuff will be created and when you browse to it you see all the filess. It's not a copy but a symbolic link, both paths refer to the sames files.

[1]: http://technet.microsoft.com/en-gb/sysinternals/bb842062 "Sysinternals Suite"

Solution 8 - Sql Server

I had no luck with any of this, my solution is to use a .bat file to create a new empty.sql file and then open it. Then in SSMS , I used 'external tools' to reun the batch. Click it and a new timed stamped .sql file is opened. I use one for each 'project'

create a .bat file

set fName=newQuery%date:~4,2%_%date:~7,2%_%date:~10,4%_%time:~1,1%_%time:~3,2%_%time:~6,2%.sql
copy _queryBlank.sql %fName%

Solution 9 - Sql Server

After searching for this topic for last 3hours, i finally got the way to do this: Changing the My Projects folder location (and other settings) in SSMS

Solution 10 - Sql Server

the registry changes did not work for me. i just put a shortcut to the network folder I wanted to use in the Mgnt Studio default save path.

Solution 11 - Sql Server

This post shows one way.

But, its, registry based, solution still has a gap... When one saves a newly created query (in my SSMS 2008 setup I open it on startup), he has to click "Projects" on the left, as save dialog opens in the standard ...\Documents\SQL Server Management Studio\Projects.

Solution 12 - Sql Server

What helped me was editing the registry and Value for DefaultFileOpenLocation

HKEY_USERS\S-1-5-21-1428394981-1396028598-1721912238-1000\Software\Microsoft\SQL Server Management Studio\18.0_IsoShell

Registry Editor screen shot:

Solution 13 - Sql Server

  1. In Object Explorer, right-click on your server and click Properties.

  2. In the left panel on that Properties page, click the Database settings tab.

  3. In Database default locations, view the current default locations for new data files and new log files. To change a default location, enter a new default pathname in the Data or Log field, or click the browse button to find and select a pathname.

NOTE: After changing the default locations, you must stop and start the SQL Server service to complete the change.

Solution 14 - Sql Server

A low tech but quick solution is to simply create a shortcut in the default folder to the one where you want to save your scripts/results/etc.... It's one extra click but involves no messing with settings or the registry.

Solution 15 - Sql Server

The easiest solution for me was to change the folders in the registry (tested with SQL Server 2014)

Make sure to close SQL Server Management Studio before

  1. Launch regedit.exe
  2. Browse to Computer\HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\xx.0 (where xx is your version)
  3. Change the different locations path you see in there
  4. Start Management Studio and try to open a file, the default directory will be yours

However, the only problem I still have is with the Save... if I create a new Query and save, it still ends up by default under /Documents/SQL Server Management Studio but if you click on the 'SQL Management Studio' link on the left you will go directly into your directory.

Solution 16 - Sql Server

You can create a symbolic link using mklink.

  1. Delete the existing project folder (copy existing files to preferred location first): rmdir "C:\Users\user\Documents\SQL Server Management Studio\SSMS Projects).
  2. Create symlink to your preferred location (example a onedrive folder): mklink /j "C:\Users\user\Documents\SQL Server Management Studio\SSMS Projects" "C:\Users\user\OneDrive - Company\SSMS Projects"

The /j options specifies a hard link that makes it appear as though the file or folder actually exists at that location. When you try to open a file in SSMS the folder should now look like this:

Example Hard Link In SSMS

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJeremyWeirView Question on Stackoverflow
Solution 1 - Sql ServerDarren GriffithView Answer on Stackoverflow
Solution 2 - Sql ServerMarshallView Answer on Stackoverflow
Solution 3 - Sql ServerHankView Answer on Stackoverflow
Solution 4 - Sql ServeredosoftView Answer on Stackoverflow
Solution 5 - Sql ServerDavid GuerraView Answer on Stackoverflow
Solution 6 - Sql ServerJohn SansomView Answer on Stackoverflow
Solution 7 - Sql ServerStephen TurnerView Answer on Stackoverflow
Solution 8 - Sql ServerWillView Answer on Stackoverflow
Solution 9 - Sql ServerLeo81View Answer on Stackoverflow
Solution 10 - Sql Servertd.View Answer on Stackoverflow
Solution 11 - Sql ServerVlSherView Answer on Stackoverflow
Solution 12 - Sql ServerTom SoulView Answer on Stackoverflow
Solution 13 - Sql ServerRafetView Answer on Stackoverflow
Solution 14 - Sql ServerMichael SchwabView Answer on Stackoverflow
Solution 15 - Sql ServerPascal VeilleuxView Answer on Stackoverflow
Solution 16 - Sql ServerdabendView Answer on Stackoverflow