April 21, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Beginner's Guide to SQL Server Database Development with VSTS Database Edition

  • June 10, 2008
  • By Jeffrey Juday
  • Send Email »
  • More Articles »

Most developers I've talked to agree that the database is the most important component in a typical business application. Yet, for years SQL Server database developers have used Administration tools shipping with SQL Server or a variety of 3rd party utilities. Visual Studio, the Microsoft flagship development environment, was the domain of the VB.NET or C# developer. TSQL support in Visual Studio was rudimentary at best.

That story changed last year with the advent of Visual Studio Team Services Database Edition. VSTS Database Edition was a late addition to VSTS 2005 and was enhanced with the VSTS 2008 release. I'm going to show you how you can incorporate VSTS Database Edition into your database development process.

Important, but not Sexy

Databases are not visually engaging. Unless a database is not working, most application users don't see any part of a database. Generally, databases don't interact with the outside world like a Web Service or an Application Control Library would.

Compared to an Object Oriented-based application, database components are tightly coupled. Tables are coupled to each other via foreign keys. Views, functions, and stored procedures are tightly coupled to tables and each other. Broken database code means a broken database or—even worse—corrupted data.

A database is not like an assembly. There is little you can do to version a SQL Server database like you would version an assembly. Tight coupling and lack of versioning have other ramifications. It's difficult for multiple developers to work on a database. Aside from TSQL, there are other things to manage like Roles and object permissions. Finally, you don't compile a database like you do an assembly.

Simple and Specialized

Alternately, Transact SQL code is pretty compact and specialized. TSQL only does data. There are no delegates, class hierarchies, or multi-threading features to support. TSQL really serves only two roles: Data Definition (DDL), statements like ALTER and CREATE; and Data Manipulation (DML), statements like INSERT, UPDATE, and DELETE. Because database code generally works in the database, there are fewer execution dependencies and test construction is easier than the many levels of testing you typically undergo with, for example, a Desktop or Web Application.

VSTS Database Edition addresses the issues above and leverages the structure of TSQL, turning Visual Studio into a capable database development environment. Now, I'll take you through a sample project so you can see VSTS Database Edition in action.

Creating a Project

First, the Database Edition only works with Visual Studio Team Suite. To showcase the tools and simplify this article, I'm going to build the project from an existing database, rather than building a database from scratch.

Like all Visual Studio development, database development is managed by using projects and solutions. A project typically corresponds to a single database. You can create SQL 2005 projects or SQL 2000 projects. I've installed some additional Power Tools, so your install may look slightly different. Figure 1 displays the SQL Server projects.



Click here for a larger image.

Figure 1: New database project

After creating the project, it's important (but not required) to match project collation with the database collation. Collation defines things such as ordering for text fields and case sensitivity. Neglecting to set collation can lead to confusing warnings and errors. Figure 2 shows where you set project collation on the project properties.



Click here for a larger image.

Figure 2: Project collation property





Page 1 of 4



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel