Bagikan melalui


Developing Solutions and Projects in SQL Server Management Studio

Solutions and script projects are containers that developers use to organize related files in SQL Server Management Studio. Manage solutions and script projects using Solution Explorer.

You can use Management Studio as a script development platform for SQL Server, Analysis Services, and SQL Server Compact 3.5 SP1. Use Management Studio to develop scripts for relational and multidimensional databases, and all types of queries. The development experience in Management Studio is enhanced by the rich mix of powerful code editors. Using Management Studio, you can do the following:

  • Write queries and scripts to support production processes.

  • Add connection information and other associated files to the project.

  • Save the queries and scripts together with their connections in a project.

  • Organize the script projects in a single container called a solution.

  • Save the solution in a Microsoft Visual SourceSafe (VSS) database or other third-party source control providers, for development change tracking and life-cycle management.

Note

To use Visual SourceSafe with Management Studio, install a Visual SourceSafe database in a location that you can access from the computer that has SQL Server Management Studio.

  • Management Studio can be customized to use other source control applications. By using the Options dialog box, you can specify the source control plug-in.

Browsing the Contents of a Script Project

SQL Server script projects are displayed in the Solution Explorer component of Management Studio. A script project can contain zero or more project files. You can add a project to a solution or combine more than one project within a solution.

A Management Studio project is a collection of logically related scripts and files that can be saved together for database administration and development. These folders can include the following:

  • Connections. A connection, as persisted within a project, will contain login information, server name, default database, preferred protocol, authentication type, and connection properties. Connection information may optionally be stored with a script (see below).

  • SQL Scripts. Frequently used SQL scripts for the user. Double-clicking a .sql file within the project will cause the SQL Editor to open the selected script.

  • MDX, DMX, and XMLA Scripts. Frequently used MDX scripts for the user. Double-clicking an .mdx file within the project will cause the Editor to open the selected script.

  • Misc. This folder can be used for files that do not neatly fit into any of the other default node types, such as a text file that contains the project objectives.

Naming Script Projects

You can set a name for the script project, but the folder names are established by Management Studio and cannot be altered. You can configure the drive and path specification for the common set of folders by using the Add New Project dialog box. Right-click the solution icon in Solution Explorer, and then click Add. The default location for script project folders is: C:\Documents and Settings\username\My Documents\SQL Server Management Studio\Projects\.

Connecting to an Instance of SQL Server from a Script Project

A script project may contain connections to an instance of SQL Server. You can connect to an instance of SQL Server in a project by clicking the connection. This will open an SQL Script window that is connected to the instance of SQL Server defined in the connection you selected. If you open a SQL Server or MDX script with a connection that uses SQL Server authentication, you will be prompted for the password using the Connect to SQL Server dialog box after the Editor has been opened and the script loaded.

The connection will be closed after the corresponding window is closed.

To modify information about a connection, use the properties window in Management Studio.