Database Project vs. SQL Server Project in Visual Studio

Just a quick overview of the difference between these two, and a few initial recommendations for their use.

SQL Server Projects are used to create Common Language Runtime (CLR ) User Defined Types (UDT) in SQL Server. Please bear in mind that unless you have a really, really good reason, the almost unanimous advice from SQL Server experts is to leave these well alone.
MS SQL  Server is a pretty advanced product, and you should not have any needs to start extending the set of datatypes available.

Database Projects on the other hand are essential tools for versioning your SQL Server Development. Note that these integrate with your VS IDE – you can for example right click a SQL table in the server explorer and choose to generate create scripts to your Database Project.

Main purpose and benifit of DB Projects is to log all your create and subsequent update scripts in here. Use folders to version these – and to keep the order of execution clear, should you ever need to rebuild your database.

On a wider more general note, this all ties in with a certain style of development, where you might use IDE’s to create, update or drop SQL Server Objects (tables, views, sprocs – whatever) – but you never do anything without creating and saving a script that executes this change using pure SQL.
This is true for both creating, altering and dropping – also make sure all your script have the proper if exists drop etc etc.

For some resources on how to do all this in SQL – we’d recommend reading: Pro T-SQL 2005 Programmer’s Guide from Apress (in general just read stuff from Apress and you’ll be ok!).

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: