So… I started today creating the same sort of SQL Server Database project that I’ve done many times before. Really simple database – just one table so far. It’s just going to be a log for a new interface between our ERP system and the new time/activity tracking system being installed.
The first indication that something was wrong is during the Data > Schema Compare. After selecting Project vs. Database, I noticed the [Write Updates] button is disabled. And a friendly looking message informing me that I can’t do what I planned to do next.
“You cannot write updates to the target when you compare the specified types of schema models.”
To date, the Google results haven’t been much help for this error message. A few hits on queries, but only one solution – from someone accidentally using the Data Tier Application Component project instead of SQL Server 2008 Database project. DAC projects cannot write updates.
I spent a little more time pushing and prodding VS 2010 and I finally got this error message out of it as well:
“SQL01275: The version of the source and the target schema do not match. You can compare these schemas, but you cannot write updates to the target schema.”
Okay – fine. Searches for “SQL01275”, “version of schema do not match”, etc. were turning up nil.
I tried comparing Database vs. Database – no problem: [Write Updates] was enabled. Proof: the functionality can still work.
I tried comparing Database file (.dbschema) vs. Database – again the error. Taking this as a clue, I went to examine the .dbschema file.
<?xml version="1.0" encoding="utf-8"?>
<DataSchemaModel FileFormatVersion="1.2" SchemaVersion="1.1"
Notice the 2nd line has another tip. The schema version of my VS 2010 Database Project file is version 1.1. Got caught in another red herring. And finally posted this thread at MSDN Forums.
Unbeknownst to me, I was importing a SQL Server 2005 database into a SQL Server 2008 Database Project.
Solution: In the Project > Properties, change the Project version to SQL Server 2005 and [Save].
Then unload and reload the database project. Opening the Schema Comparison again, produces the expected result.