Share via


Troubleshooting Schema Compare Issues

You might encounter the issues in this topic when you compare two database schemas.

Dependencies and Update Scripts

To generate the correct order of objects in an update script, Schema Compare examines object dependencies. For example, if a view depends on a table, the table must be created before the view. If the object that depends on the second object does not use a schema-qualified name, the dependency might not be identified and the update or creation script might have statements in an incorrect order. This difference can cause errors when you update a target to match a source or deploy changes to a database. This issue also applies to database build scripts.

Note

To work around this issue, make sure to schema-qualify the names of objects that are involved in dependent relationships. In the following example, you can guarantee that the dependency will be correctly identified if you change the end of the statement to reference [dbo].[KeysTable] instead of just KeysTable:

CREATE VIEW [NewUser].[ViewReferencingScalarFunction] AS SELECT Column2, dbo.SimpleMultiplyParamByTwo(PK_Column) AS [Function] FROM KeysTable

Table and Index Options

Schema Compare does not compare or script options that are set using the sp_tableoption or the sp_indexoption. There is no workaround for this issue.

Time-out when Comparing Large Databases

If you receive a time-out error when you compare the schemas of large databases, you might need to increase the time-out value. This option is not exposed through the user interface. You must modify the QueryTimeoutSeconds value that is stored in the registry under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\VSTSDB\Database and specified in seconds. By default, the time-out is 60 seconds.

Comparing Files and Filegroups

If a filegroup in a target database is read-only, that property will always appear as a difference in a schema comparison between that database and a database project. In addition, the primary filegroup is ignored when you compare schemas.

In addition, if you try to synchronize two databases on the same server, you might have issues when you try to synchronize the secondary files and filestreams. You can resolve these issues by excluding the filegroups and files when you synchronize.

See Also

Tasks

How to: Modify Database Objects

How to: Compare Database Schemas

How to: Compare and Synchronize the Data of Two Databases