Learn more about SQL Server tools

solving sql server problems for millions of dbas and developers since 2006
join MSSQLTips for free SQL Server tips

































Top SQL Server Tools






















SQL Server Management Studio customized startup options

MSSQLTips author Tim Ford By:   |   Read Comments (6)   |   Related Tips: More > SQL Server Management Studio

Problem
SQL Server Management Studio (SSMS) is now the primary tool that we all use to manage SQL Server.  Whenever I open up SSMS I always go through the same steps to connect to a server and open certain query files.  Are there any shortcuts or alternative ways of starting SSMS?

Solution
SQLWB (sqlwb.exe) is the executable file that launches SQL Server Management Studio (SSMS). Most-likely the name corresponded to the original working name for Management Studio during the development phase of Yukon (the project title for what would eventually become SQL Server 2005): SQL Server Workbench. What many SQL Server professionals fail to realize is that the startup behavior of SSMS is customizable.  By simply passing parameter values along with the command to launch sqlwb, you can open default queries, projects, or connections.  You can also control whether to launch SSMS with the application's splash screen.  Let's take a look at the list of parameters available, courtesy of SQL Server Books Online:

sqlwb

[scriptfile] [projectfile] [solutionfile]

[-S servername] [-d databasename] [-U username] [-P password]

[-E use Windows security]

[-nosplash]

[-?]

Arguments

The [scriptfile], [projectfile], and [solutionfile] parameters specify a file (or in the case of [scriptfile], the possibility of multiple files to open upon launch of SSMS.  If  you do not specify parameter values for servername, databasename, username, or password when you launch sqlwb and specify a script(s), project, or solution you will be prompted for the applicable security context for the file(s) you are opening. 

Let's look at some examples of the behavior associated with the various options for launching SQL Server Management Studio from a Run command or Command Prompt:

Open a single script (.sql) file upon SSMS startup

sqlwb "C:\Temp\Config1.sql"

This command launches SQL Server Management Studio and prompts you for the connection information.  Note the query name in the background of this screen shot.

Open multiple sql query (.sql) files upon SSMS startup

The process for opening multiple SQL query files is only slightly different, simply list each of the full file paths for each query file you wish to open, separated by a space, after the call to sqlwb as shown in this screen image:

sqlwb "C:\Temp\Config1.sql" "C:\Temp\Config2.sql"

Without specifying the connection information in the run command for sqlwb you will be prompted for the SQL instance and security information upon launch of SSMS.  Note that once authenticated each of the queries connect using that same criteria.  This bears repeating: each .sql file will connect to the instance you specify, as the login you specify, when launching SSMS in this manner.

Open a SQL Server Management Studio Project (.ssmssqlproj) file upon SSMS startup

Microsoft provided an additional layer of project management with the release of SQL Server 2005.  The concept of a solution and project was nothing new to the developers out there.  This concept has been a component of the Visual Studio architecture for many previous releases.  However, in the continuing streamlining between SQL Server and Visual Studio interfaces, the concept finally was incorporated into the SQL Server management tools.  Simply put, a SQL Server Project file is a collection of various connections,  queries, and other objects that are organized to be utilized for a common purpose.  I personally use SSMS Projects for such purposes as Standard Installations, Daily Maintenance Checks, and Security Audits.  Just as SSMS Projects are a collection of multiple components, SSMS Solutions are a collection of multiple SSMS Projects.  The syntax for launching an SSMS Project or Solution is no different than launching a single .sql file from the command line or Run menu. 

Let's look at the following example; we will specify an existing .ssmssqlproj file, connecting with Integrated (Windows) security to the Sauron.Northwind database.

sqlwb "C:\Config\Config.ssmssproj" -S sauron -d Northwind -E

Additionally, you can open a SSMS Solution by providing a solution file path (...\*.ssmssln) as a parameter.  The following command opens the solution file Config.ssmssln, passing the connection information for the Foo login against the sauron instance of SQL Server:

sqlwb "C:\Temp\SSMS Projects\Configuration\Configuration.ssmssln"-S sauron -d Northwind -U Foo -P pwFoo  

Additional Parameters

Here are some additional options.

  • Launches SQL Server Management Studio without the splash screen
sqlwb -nosplash
  • At any time you are unsure about the parameters available for sqlwb, you can append the -? parameter to display the following help information.
sqlwb -?

 Don't feel that you're forced into launching SQL Server Management Studio with the default splash screen and an initial instance connection.  The parameters associated with sqlwb.exe allow you to specifically control your startup parameters for files and connections.

Next Steps

  • To learn more about the organizational benefits that SSMS Projects provide check out this related tip:  Using Solutions and Projects to Manage Your SQL Server Code.
  • Search through the forums on MSSQLTIPS.com and see if you are able to assist a fellow SQL Server Professional with their questions.


Last Update: 10/10/2008


About the author
MSSQLTips author Tim Ford
Tim Ford is a Senior Database Administrator and SQL Server MVP. He has been working with SQL Server since 1999.

View all my tips
Related Resources


print tip Print  
Become a paid author




Recommended For You








Learn more about SQL Server tools
Comments and Feedback:
Monday, October 27, 2008 - 8:02:55 AM - DataWrangler Read The Tip

 "SQLWB (sqlwb.exe) is the executable file that launches SQL Server Management Studio (SSMS). Most-likely the name corresponded to the original working name for Management Studio during the development phase of Yukon..."

The name "SQL Workbench" goes back farther than Yukon's development. When the SQL Server 6.0 beta was demonstrated to users, the name for what would become Enterprise Manager was SQL Work Bench. I guess that wasn't a cool enough name for the marketing department because it had changed by the time SQL Server 6.0 was released. The file name didn't change though, so I would guess the app name change was a last minute change before it was released to production.


Thursday, January 26, 2012 - 7:56:04 AM - Leif Neland Read The Tip

In SQL Server Management Studio for SQLserver 2008 R2, the filename has been changed to ssms.exe

 

If the -d database_name switch is supposed to open the left window at the selected database, it does not work (anymore)

 


Wednesday, March 28, 2012 - 11:37:02 AM - Robert Read The Tip

SO, I want to stop the login screen from coming up.  How do I do that?


Tuesday, May 01, 2012 - 1:13:49 PM - Dan Dapkus Read The Tip

Is there any way to get a substitute splash screen to appear in place of the default splash screen?  I have a client with a high security and they want a warning to appear in place of or in addition to the standard splash screen.

Thanks,
Dan


Tuesday, May 29, 2012 - 8:26:20 PM - Johnie Karr Read The Tip

Robert: in order to prevent the login screen from coming up on startup you can follow these steps:

  1. In SSMS goto Tools-->Options
  2. Go to the Environment tab
  3. In the dropdown next to "At startup:" select "Open empty environment"
  4. Restart SSMS

Tuesday, September 18, 2012 - 12:51:52 PM - shaun Read The Tip

Just thought I'd let you kow this post has been plagarized at http://feel-tech-evolution.blogspot.com/2012/02/sql-server-management-studio-customized.html



Post a Comment or Question

Keep it clean and stay on the subject or we may delete your comment.
Your email address is not published. Required fields are marked with an asterisk (*)

*Name   *Email Notify for updates

Signup for our newsletter


Comments
*Enter Code refresh code


 
Sponsor Information







Copyright (c) 2006-2014 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | about
authors | contribute | feedback | giveaways | user groups | community | events | first timer?
Some names and products listed are the registered trademarks of their respective owners.