I am using the Visual Studio 2012 schema comparison tool to diff an actual database with a Microsoft SQL Server DAC Package File (dacpac
). The expectation is that the database and the file are "equal". However, the schema comparison reports differences in the BodyScript
property of three stored procedures, all of which contain lots of dynamic SQL. What's frustrating, though, is that in the actual diff of the object definitions, there are no apparent differences between the definitions of the stored procedures. Furthermore, we've copied the scripts into a number of different diff tools to look for whitespace-type differences, but it appears that the two scripts are binary identical. We've played around with numerous schema comparison options (ignore whitespace, ignore keyword casing, etc.), but nothing seems to fix this problem.
In researching this issue, I've come across similar problems posted on Microsoft Connect and also here on StackOverflow, but it appears that these issues have yet to be resolved. Does anyone have any suggestions for other ways to address this problem?
Schema Comparison Tool allows you to compare tables, views, functions, sequences, packages, stored procedures and other database objects between two schemas/databases. It will report any discrepancies between schemas such as missing or mismatching stored procedures, tables, triggers, columns, indexes and constraints.
To compare database definitions. On the Tools menu, select SQL Server, and then click New Schema Comparison. Alternatively, right-click the TradeDev project in Solution Explorer, and select Schema Compare. The Schema Compare window opens, and Visual Studio automatically assigns it a name such as SqlSchemaCompare1 .
DDL Comparison for Views DDL comparison for a view compares the columns of the source view with the columns of the source table. It does not compare the definitions of the source and target views. To compare DDL when copying data from a view, the copyData attribute for the view must be set as true.
It appears that this problem is caused by new line characters in string literals.
This is bad:
DECLARE @badQuery NVARCHAR(MAX) = N'SELECT
*
FROM
[dbo].[MyRadTable]';
This is good:
DECLARE @goodQuery NVARCHAR(MAX) = N'SELECT '+
'* ' +
'FROM ' +
'[dbo].[MyRadTable]';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With