I recently discovered a little "gotcha" when using the Data Compare feature Visual Studio 2005 for Database Professionals*: it silently ignores data in any table that lacks a primary key.
Now I would never accuse you of creating tables without primary keys, ;-) but you just might inherit a database in such a condition. Seriously though, many developers (including me) often leave PKs off their join tables, since they're usually composed of nothing but foreign keys anyway. If that's you too and you plan on using the Database Professionals tools for Visual Studio, just remember you'll have to go back and add those primary keys. It's a good habit to get in anyway, since it forces you to be explicit about your unit of uniqueness for joins, e.g. you have to consider whether you need an identity column or can simply create a PK across one or more of the FK columns.
* If you do SQL development and aren't familiar with this great set of tools, check 'em out! This setup considerably eases three essential database tasks: (a) Getting your object definitions under source control, (b) comparing schemas and migrating changes between environments, and (c) comparing data between environments and applying the diff from one server to another.
Visual Studio 2005 Team Edition for Database Professionals Add-on for Visual Studio 2005 Team Suite Edition
http://www.microsoft.com
Microsoft® Visual Studio® 2005 Team Edition for Database Professionals Service Release 1
http://www.microsoft.com
Microsoft® Visual Studio® 2005 Team Edition for Database Professionals Power Tools
http://www.microsoft.com
No comments:
Post a Comment