« Home « Kết quả tìm kiếm

Microsoft SQL Server 2008 R2 Unleashed- P15


Tóm tắt Xem thử

- FIGURE 4.23 Solutions and projects listed in the Solution Explorer..
- The Solution Explorer contains a tree-like structure that organizes the projects and files in the solution.
- Figure 4.23 shows an example of the Solution Explorer.
- When adding the new project, you are given a choice of the type of project, and you must select either SQL Server Scripts, Analysis Services Scripts, or SQL Mobile Scripts.
- Each one of these project types is geared toward the respective SQL Server technology..
- The Solution Name is entered at the bottom of the New Project window and an option to create a separate directory for the solution is provided.
- After the project is added, you can add the related connections and files.
- The Connections entries allow you to store SQL Server connection information that relates to the project you are working on.
- When a connection is included in the project, you can double-click it, and a new query window for that connection is established..
- You can also add existing files to a project.
- The file types listed in the drop-down at the bottom of the Add Existing Item dialog include SQL Server files ( *.sql.
- SQL Server files are added, by default, to the Queries node.
- The connection entries are not stored in a separate file but are contained in the project file itself..
- Integrating SSMS with Source Control.
- SSMS has the capability to integrate database project files into a source control solution..
- Source control provides a means for protecting and managing files.
- Source control applica- tions typically contain features that allow you to track changes to files, control and track who uses the files, and provide a means for tagging the files with a version stamp so that the files can be retrieved at a later time, by version..
- SSMS can integrate with a number of different source control applications.
- Visual SourceSafe is Microsoft’s basic source control solution, but other source control applica- tions can be used instead.
- The source control client application must be installed on the machine on which SSMS is running.
- When the installation is complete, you can set the source control application that SSMS will use within SSMS.
- To do this, you select Tools, Options and navigate to the Source Control node.
- The available source control clients are listed in the Current Source Control Plug-in drop-down..
- The link between SSMS and the source control application is the database solution.
- After a solution is created, it can be added to the source control.
- To add a solution to a source control application, you open the Solution Explorer and right-click the solution or any of the projects in the solution.
- You then see the Add Solution to Source Control option.
- You must then log in to the source control application and select a source control project to add the solution to..
- When the solution is added to a source control application, all the related projects and project files are added as well.
- The projects and files in the source control application have additional options available in the Solution Explorer.
- Figure 4.24 shows a sample solution added to a source control application.
- A subset of the source control options available when you right-click project files are shown in this figure as well..
- ptg FIGURE 4.24 Source control options in the Solution Explorer..
- The options related to source control are listed toward the bottom of the options list.
- The options that are available depend on the status of the selected file.
- Following are some of the common source control options:.
- Check Out for Edit—This option allows you to get a copy of the file from the source control application so that you can modify the file.
- When you check out the file, the source control provider can keep track of the user who has checked out the file, and it can also prevent other users from checking out the file..
- Check In—This option copies the locally modified file into the source control solu- tion.
- The file must first be checked out for editing before you can use the Check In option.
- A new version for the file is established, and any prior versions of the file are retained as well..
- Get Latest Version—This option gets a read-only copy of the latest version of the project file from the source control application.
- Compare—This option enables you to compare versions of source control files.
- The default comparison that is shown is between the file in the source control applica- tion and the local file on your machine..
- Get—This option is similar to the Get Latest Version option, but it retrieves a read- only copy of the file.
- View History—This option lists all versions of the files checked into the source control application.
- The History dialog box has many options that you can use with.
- files, view the contents of a specific version, generate reports, or get an older version of the file..
- Undo Checkout—This option changes the checkout status in the source control application and releases the file to other source control users.
- Any changes made to the local copy of the file are not added to the source control version..
- Other source control options are available via the Source Control menu in SSMS.
- You select an item in the Solution Explorer and then select File, Source Control.
- You can use this menu to check the status of a file by using the SourceSafe Properties option, set source control properties, launch the source control application, and perform other source control operations..
- They can speed up the development of these scripts and help enforce consistency in the genera- tion of the underlying database objects..
- The Template Explorer is a component window available in SSMS and replaces the Template tab available in the SQL Server 2000 Query Analyzer.
- Figure 4.25 shows the Template Explorer and the available SQL Server template folders.
- Separate templates also exist for Analysis Services and SQL Server Mobile Edition.
- You can view them by selecting the related icon at the top of the Template Explorer..
- You access the available templates by expanding the template folder in the Template Explorer tree.
- If you double-click one of the templates, a new query editor window appears, populated with the template script.
- Figure 4.26 shows the template script displayed when you open the Create Index Basic template..
- The template script contains template parameters that have the following format within the script:.
- You can manually replace these parameters in the script, or you can use the Specify Values for Template Parameters option from the Query menu to globally replace the parameters in the script with the desired values.
- FIGURE 4.26 The template script for creating a basic index..
- It is best to leave the template script unchanged before you specify values for the parameters.
- After you enter the parameter values and click OK, the values are reflected in the script..
- For example, the values shown in Figure 4.27 for the basic index template result in the following script:.
- You can also create your own template folder that will be displayed in the Template Explorer tree.
- To create a new template folder, you right-click the SQL Server Templates node in the Template Explorer tree and select New, Folder.
- A new folder appears in the tree, and you can specify a new folder name.
- Figure 4.28 shows the Template Explorer with a set of custom.
- When you double-click a template in the Template Explorer tree, you create a script based on the template.
- Changes made to the script do not affect the template.
- they affect only the script generated from the template.
- To change the actual template, you need to right-click the template and select Edit.
- After you complete your changes, you need to make sure to save the template..
- Finally, you are able to debug T-SQL from within the SQL Server development environ- ment.
- Yes, you could do this kind of thing using Visual Studio, but database developers should be able to debug in the environment where they generally develop their SQL state- ments—within SSMS.
- SQL Server 2008 provides this capability, and it works well..
- To do this, you right-click on the stored procedure in the Object Explorer and select Script Stored Procedure As, Execute To, New Query Editor Window, and a script for executing the procedure is generated.
- To initiate debugging, you click on the green arrow on the SQL Server menu bar.
- After the code snippet is added as a template, you can open a new query editor win- dow based on the template or simply drag and drop the template from the Template Explorer to an existing query editor window, and the code for the template is pasted into the window..
- You can now use the debug toolbar at the top of the SSMS screen to step through your code.
- Figure 4.29 shows an example of the T-SQL Debugging Environment while debugging is in progress.
- Another slick new option available with SQL Server 2008 is the capability to execute a script on multiple servers at once.
- After the group is created and servers are registered in the group, you can right-click on the group and select the New Query option to create a query window that can be run against all the servers in the group.
- Figure 4.30 shows a server group named MyTestGroup containing three servers registered in that group, a sample query to run against these servers, and a single result window that shows the results of the query for all servers in the group..
- These queries are backward compatible and allow you to run against prior versions of SQL Server, including SQL Server 2005.
- Remember that you can customize this environ- ment and hide many of the windows that are displayed.
- This configuration may allow you to accomplish a majority of your SQL Server tasks.
- Chapter 5 looks at the SQL Server utilities that can be run from the command prompt..
- These tools allow you to perform some of the same tasks available in SSMS.
- CHAPTER 5 SQL Server Command- Line Utilities.
- What’s New in SQL Server Command-Line Utilities .
- T his chapter explores various command-line utilities that ship with SQL Server.
- In some cases, they provide functionality that is also available with SQL Server’s graphical user interface (GUI).
- For the full syntax and options available for the utility, see SQL Server Books Online..
- This chapter focuses on command-line utilities that are core to SQL Server and the SQL Server database engine.
- Several other command-line utilities that are used less frequently or geared toward other SQL Server services are not covered in this chapter.
- These utilities include dtexec and dtutil , which can be used with SQL Server Integration Services (SSIS).

Xem thử không khả dụng, vui lòng xem tại trang nguồn
hoặc xem Tóm tắt