Chapter 1: The Development Environment 9 can include one or more projects, in addition to files and metadata that help define the solution as a whole. A project is a set of files that contain connection information, query files, or other miscellaneous and related metadata files. Figure 1-5 shows the Solutions Explorer window. The types of projects you can have in your solution include: SQL Server Scripts, SQL Mobile Scripts, and Analysis Services Scripts. SQL Server Scripts The SQL Server Scripts projects are used to group together related SQL Server connections and T-SQL scripts. A common use for this type of project is to group together Data Definition Language (DDL) queries that define the objects in your database. Analysis Server Scripts Analysis Server Scripts projects are intended to contain Analysis Server connections as well as MDX, DMX, and XMLA scripts. One way you can use this type of project is to have one project contain the scripts that create your data warehouse and another project contain the scripts to load your data warehouse. Figure 1-4 Summary Page 10 Microsoft SQL Server 2005 Developer’s Guide SQL Mobile Scripts SQL Mobile Scripts projects are used to group together the connections and queries for a SQL Server CE database. For a SQL Server CE project, a connection object represents the connection to the CE database. The top item listed in the Solution Explorer is the name of the SQL Server Management Studio solution. By default this name is Solution 1, but you can change this to whatever name you want by right-clicking the solution and selecting Rename from the context menu. The files that are listed in the Solution Explorer can be associated with a project, or else they can be associated with the SQL Server Management Studio solution itself without an intermediate project. Properties Window The Properties window allows you to view the properties of files, projects, or solutions in SQL Server Management Studio. You can see the Properties window in the lower right-hand corner of Figure 1-1. If the Properties window is not already displayed, you can show it by selecting the View | Properties Window option from the Management Studio menu. The Properties window displays different types of Figure 1-5 Solution Explorer Chapter 1: The Development Environment 11 editing fields, depending on the type of object selected. Properties shown in gray are read-only. A Properties dialog is also available that permits you to view the properties of database objects. To display the Properties dialog, right-click a database object and select Properties from the context menu. An example of a Properties dialog is shown in Figure 1-6. Query Editor The Query Editor is the replacement for Query Analyzer found in previous versions of SQL Server. It allows you to write and run T-SQL scripts, MDX, DMX, XMLA queries, or mobile queries. You can see the Query Editor in the upper-middle portion of Figure 1-7. You start the Query Editor from the SQL Server Management Studio by selecting the New Query option on the Management Studio main page and choosing the query Figure 1-6 Properties dialog box 12 Microsoft SQL Server 2005 Developer’s Guide type to create. Unlike the Query Analyzer, which always worked in connected mode, the new Query Editor has the option of working in either connected or disconnected mode from the server. By default it automatically connects to the server as soon as you opt to create a new query. Like its Visual Studio 2005 counterpart, the Query Editor supports color-coded keywords, visually shows syntax errors, and enables the developer to both run and debug code. In addition, the Query Editor supports the concept of projects, where groups of related files can be grouped together to form a solution. The new Query Editor also offers full support for source control using Visual SourceSafe. It is able to display query results in a grid or as text, and it is able to graphically show a query’s execution plans. There is also an option to save your scripts using the built-in SourceSafe version control. Version control facilitates group development by preventing multiple developers from simultaneously changing the same module. Source code must be checked out of the code repository before it can be modified Figure 1-7 Query Editor Chapter 1: The Development Environment 13 and then checked back in, giving you a central location to store your database code. Using version control with your database creation scripts provides a valuable method for isolating the source code associated with each release of your database schema. This can also act as a basis for comparing the schema of a deployed database to the expected schema that’s been saved using version control. Query Editor also has the capability to graphically represent a query’s execution plan. The Execution Plan option graphically displays the data retrieval methods chosen by the Query Optimizer. Figure 1-8 shows the execution plan for the query shown in Figure 1-7. Results Window The results of the queries that are executed in the Query Editor are displayed in the SQL Server Management Studio’s Results window. You can see the Results window in the lower-middle portion of Figure 1-7. You can set the Results window to display query results either in text format or in a grid. Figure 1-8 Execution plan 14 Microsoft SQL Server 2005 Developer’s Guide SQL Server 2005 Administrative Tools This section gives you an overview of the SQL Server 2005 administrative tools, including: ᭤ Profi ler enhancements ᭤ Database Tuning Advisor ᭤ Assisted editors Profiler Enhancements With SQL Server 2005, Profiler gets an overhaul as well. The new Profiler now supports the ability to trace both SSIS and Analysis Services commands. SQL Server 2000 was limited to tracing relational database calls only. By having these capabilities, you can use these traces to debug any problems you have in these additional components of SQL Server. Also, Performance Monitor correlation works with these new trace types. Profiler allows you to save the trace file as XML. Furthermore, a traced ShowPlan result can be saved as XML and then loaded into Management Studio for analysis. The Profiler is described in detail in Appendix A. Database Tuning Advisor Profiler also integrates with the new Database Tuning Advisor, which replaces the Index Tuning Wizard. The DTA has a rich, new interface and works with the newer features in SQL Server 2005; for instance, it will recommend partitioning your tables using the new table partitioning features in the database engine. Assisted Editors Management Studio contains new capabilities, called assisted editors, to make writing stored procedures, views, and functions easier. Instead of having to manually create the header information for these types of objects, you can use the assisted editors to quickly point and click to set information. BI Development Studio While SQL Server Management Studio is used to develop relational database projects and administer and configure existing objects in SQL Server 2005, the new Business Intelligence (BI) Development Studio is used to create Business Intelligence solutions. Chapter 1: The Development Environment 15 Unlike the SQL Server Management Studio, the BI Development Studio is not really designed to be an administrative tool. You use the BI Development Studio to work with Analysis Services projects, to develop and deploy Reporting Services reports, and to design Integration Services (SSIS) packages. The BI Development Studio is accessed using the Start | Programs | Microsoft SQL Server | Business Intelligence Development Studio menu option. You can see the BI Development Studio in Figure 1-9. The BI Development Studio, like the SQL Server Management Studio, is built on the Visual Studio 2005 IDE. It provides a solution-oriented development environment and contains one or more projects in a solution. BI Development Studio enhances the development of business intelligence applications by allowing project development in a source-controlled, multiuser environment without requiring an active connection to a server. Each of the project types will contain the specific object definitions for those projects. For example, a Reporting Services project will contain Report definitions, while an SSIS project will contain SSIS package objects. Like the SQL Server Figure 1-9 Business Intelligence Development Studio 16 Microsoft SQL Server 2005 Developer’s Guide Management Studio, the BI Development Studio doesn’t allow you to compile VB.NET, C#, J#, or VC++. Instead, the BI Development Studio is designed expressly for working with BI projects like SSIS and Reporting Services. The BI Development Studio is also integrated with Visual SourceSafe for source code version control. The Business Intelligence Development Studio User Interface The Business Intelligence Development Studio user interface is an excellent environment for developing business intelligence solutions, including cubes, data sources, data views, reports, and data transformation packages. BI Development Studio User Interface Windows This section gives you an overview of the BI Development Studio user interface main windows, including: ᭤ The Designer window ᭤ The Solutions Explorer window ᭤ The Properties window ᭤ The Toolbox window ᭤ The Output window The Designer Window The Designer window provides a graphical view of an object and is the central window in the BI Development Studio. A different designer type inhabits the designer window in response to the current BI Development Studio object type. For example, if you are developing an SSIS package, the Designer window provides the design surface to drag and drop objects from the Control Flow toolbox to the project, while the Report Designer provides the design surface to create and preview reports. Solution Explorer Like the SQL Server Development Studio, the BI Development Studio has a Solution Explorer window. The Solution Explorer is shown in the upper right-hand corner of the screen shown in Figure 1-9. The Solution Explorer provides a hierarchical tree view of the projects and files that compose a BI Development Studio solution. The top item in the Solution Explorer hierarchy is the solution name. The solution can have one or more project items under it. The BI Development Studio Solution Explorer provides project templates, including: Analysis Services Project, Integration Services Project, Chapter 1: The Development Environment 17 Import Analysis Services 9.0 Database, Report Project, Report Project Wizard, and Report Model Project. As in the SQL Server Management Studio, BI Development Studio solutions are not restricted to one project. You can create solutions that are made up of any of the supported project types. You can see the Business Intelligence Development Studio’s New Project dialog in Figure 1-10. Analysis Services Project Analysis Services projects contain the definitions for the objects in an Analysis Services database. These include designing and creating Analysis Services databases, data source views, cubes, and dimensions, as well as working with the data mining features. ᭤ Analysis Services database An Analysis Services database created using BI Development Studio includes the XML defi nitions for the database and its objects for later deployment to a specifi c instance of Analysis Services. To create an Analysis Services database, you select the File | New | Project option from the main BI Development Studio menu. Then from the dialog displayed, select the Analysis Services Project template from the Business Intelligence project type. Figure 1-10 Business Intelligence Development Studio—New Project 18 Microsoft SQL Server 2005 Developer’s Guide ᭤ Data source views A data source view is a document that describes the schema of an underlying data source. Such a view contains names and descriptions of selected database objects, such as tables, views, and relationships, that online analytical processing (OLAP) and data mining objects in Analysis Services reference. These objects can be organized and confi gured to provide a complete schema. You can develop an Analysis Services project without having to have an active connection to the data source, because the data source view caches the metadata from the data source it is built upon. Using a data source view, you can defi ne a subset of data from a larger data warehouse. ᭤ Cube Wizard A cube is a multidimensional structure that contains dimensions and measures; where dimensions defi ne the structure of the cube, and measures provide the numerical values that the end user is interested in. The Cube Wizard is a visual tool that you can use to quickly create OLAP cubes. It is started by double-clicking the Cube node shown under an Analysis Services project or by right-clicking the Cube node and selecting View Designer. ᭤ Dimension Wizard A dimension is a collection of objects that describe the data that is provided by the tables in a data source view. You can organize these dimensions into hierarchies that allow you to navigate paths to the data in a cube. Typically, users will base their analyses on the description attributes contained in the dimensions, such as time, customers, or products. A Dimension Wizard is provided in the BI Development Studio to guide you through the steps for specifying the structure of a dimension. ᭤ Data Mining Designer A Data Mining Designer is provided as a primary environment, which allows you to work with mining models in Analysis Services. You can access the Data Mining Designer by selecting an existing item in a mining structure project, or you can use the Data Mining Wizard to create a new item. Using the Data Mining Designer, you can modify a mining structure, create new mining models, compare models, or create prediction queries. Integration Services Project Integration Services projects contain folders and files that allow you to manage the object definitions of data sources, data source views, and packages for SSIS solutions. Data sources are defined as project-level, which means you can have multiple projects in your solution that reference a single data source object. Data source views can be referenced by sources, transformations, and destinations in your project, and packages contain a collection of connections, control flow elements, data flow elements, event handlers, variables, and configurations. SSIS Designer The BI Development Studio contains an SSIS Designer, which is a graphical tool for creating packages. It has four tabs, one each for building the four elements of the SSIS project, including: the package control flow, the data flows, the . Page 10 Microsoft SQL Server 2005 Developer’s Guide SQL Mobile Scripts SQL Mobile Scripts projects are used to group together the connections and queries for a SQL Server CE database. For a SQL Server. grid. Figure 1-8 Execution plan 14 Microsoft SQL Server 2005 Developer’s Guide SQL Server 2005 Administrative Tools This section gives you an overview of the SQL Server 2005 administrative tools, including: ᭤ . include: SQL Server Scripts, SQL Mobile Scripts, and Analysis Services Scripts. SQL Server Scripts The SQL Server Scripts projects are used to group together related SQL Server connections and T-SQL