SQL Server is not just a relational
database; it contains many other components including SQL Server
Reporting Services, SQL Server Analysis Services, and SQL Server
Integration Services. Each one of these components solves completely
different problems, and for the most part, each is managed and
developed differently than SQL Server itself. In earlier versions of
SQL Server, developers who wish to develop reports for Report Server,
cubes for Analysis Services, or packages for Integration Services used
a tool called the Business Intelligence
Development Studio. This tool was essentially a Visual Studio shell
with snap-ins to provide the development experience. The experience is
the same as having Visual C# or Visual Basic.NET within a Visual Studio
shell. SQL Server developers could use Visual Studio itself, and
depending on the version Visual Studio, would have advanced database
tools to perform tasks like comparing schemas and data. Starting in SQL
Server 2012, a new feature called SQL Server Development Tools (SSDT)
attempts to bind Business Intelligence Studio and the database
development capabilities within a traditional Visual Studio
environment. At the time of this writing, the tool is in the Community
Technology Preview 3 (CTP3) stage of development and can be downloaded
from http://msdn.microsoft.com/en-us/data/gg427686
.
The focus of SSDT is to accelerate the
development of data-based applications against SQL Server and SQL
Azure. SSDT supports development in the following platforms: SQL Server
2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL
Azure.
Until now, we have been discussing development
of SQL Server via SSMS. SSMS makes an active connection to SQL Server
to obtain the necessary information to populate the IntelliSense
context menus and to function usefully in general. If you’re wearing
your development hat, you want a source-code–driven development model
as opposed to a database-driven model. With SSDT, this is possible,
since SSDT supports a robust, offline set of development features.
Before we get into the offline experience, let’s look at SSDT in
connected mode.
Working with SSDT in Connected Mode
Once you install SSDT, launch it from the Start
Menu. To create a new project, click File, followed by New, and then
Project from the main menu bar. Select SQL Server Database Project, and
name it UsedCar Application. To connect to a SQL Server instance, click
the View menu in the toolbar, and select Server Explorer. This will
launch the Server Explorer .
For now, click the Add Server button in the Server Explorer toolbar,
and connect to the local SQL Server instance. The Server Explorer
window will populate just like Object Explorer, as shown in Figure 1.
Figure 1. Server Explorer
Right-click the server node, and select New
Query. On this sample server, we have the UsedCar database and
data-tier application installed. In connected mode, we have
IntelliSense, just as we had with SSMS. For example, if you type SELECT * FROM SALES., you will get a drop-down list of available objects. If you select the Orders
table and use your mouse to hover over the asterisk, you see additional
information, such as all the columns that would be returned and their
respective data types, as shown in Figure 2.
Figure 2. Table definition within the query
What if you wanted to delete or change an
object but were not clear of its impact? One very useful feature of the
tool is that it will tell you exactly what must happen to delete that
object. Since our UsedCar schema is relatively small, to help
illustrate this, we went to the AdventureWorks database and tried to
delete the Product.Products
table. Figure 3 shows the dialog that popped up when we tried to delete this object.
Figure 3. The Preview Database Updates dialog
In the dialog shown in Figure 3, you can see which functions would be broken, which indexes would be dropped and lots of other helpful information.