Partilhar via


sqlwb Utility

The sqlwb utility opens SQL Server Management Studio. If specified, sqlwb also establishes a connection to a server, and opens queries, scripts, files, projects, and solutions.

You can specify files that contain queries, projects, or solutions. Files that contain queries are automatically connected to a server if connection information is provided and the file type is associated with that type of server. For instance, .sql files will open a SQL Query Editor window in SQL Server Management Studio, and .mdx files will open an MDX Query Editor window in SQL Server Management Studio. SQL Server Solutions and Projects will open in SQL Server Management Studio.

Note

Thesqlwb utility does not run queries. To run queries from the command line, use the sqlcmd utility.

Syntax

sqlwb
    [scriptfile] [projectfile] [solutionfile]
    [-S servername] [-d databasename] [-U username] [-P password] 
    [-E] [-nosplash] [-?]

Arguments

  • scriptfile
    Specifies one or more script files to open. The parameter must contain the full path to the files.
  • projectfile
    Specifies a script project to open. The parameter must contain the full path to the script project file.
  • solutionfile
    Specifies a solution to open. The parameter must contain the full path to the solution file.
  • [-S servername]
    Server name
  • [-d databasename]
    Database name
  • [-U username]
    User name when connecting with SQL Server Authentication
  • [-P password]
    Password when connecting with SQL Server Authentication
  • [-E]
    Connect using Windows authentication
  • -nosplash
    Prevents SQL Server Management Studio from displaying the splash screen graphic while opening. Use this option when connecting to the computer running SQL Server Management Studio by means of Terminal Services over a connection with a limited bandwidth. This argument is not case-sensitive and may appear before or after other arguments
  • [-?]
    Displays command line help

Remarks

All of the switches are optional and separated by a space except files which are separated by commas. If you do not specify any switches, sqlwb opens SQL Server Management Studio as specified in the Options settings on the Tools menu. For example, if the Environment/General page At startup option specifies Open new query window, sqlwb will open with a blank Query Editor.

Files that contain queries will prompt to be connected to a server if connection information is provided and the file type is associated with that type of server. For instance, .sql files will open a SQL Query Editor window in SQL Server Management Studio, and .mdx files will open an MDX Query Editor window in SQL Server Management Studio. SQL Server Solutions and Projects will open in SQL Server Management Studio.

The following table maps server types to file extensions.

Server type Extension

SQL Server

.sql

SQL Server CE

.sqlce

SQL Server Analysis Services

.mdx

.xmla

Examples

The following script opens SQL Server Management Studio from a command prompt with the default settings:

sqlwb

The following script opens SQL Server Management Studio from a command prompt, with Windows Authentication, with the Code Editor set to the server ACCTG and the database AdventureWorks, without showing the splash screen:

sqlwb -E -S ACCTG -d AdventureWorks -nosplash

The following script opens SQL Server Management Studio from a command prompt, and opens the MonthEndQuery script.

sqlwb "C:\Documents and Settings\username\My Documents\SQL Server Management Studio Projects\FinanceScripts\FinanceScripts\MonthEndQuery.sql"

The following script opens SQL Server Management Studio from a command prompt, and opens the NewReportsProject project on the computer named developer:

sqlwb "\\developer\fin\ReportProj\ReportProj\NewReportProj.ssmssqlproj"

The following script opens SQL Server Management Studio from a command prompt, and opens the MonthlyReports solution:

sqlwb "C:\solutionsfolder\ReportProj\MonthlyReports.ssmssln"

See Also

Other Resources

Introducing SQL Server Management Studio

Help and Information

Getting SQL Server 2005 Assistance