We're doing a SQL Server 2005 upgrade to 2008 and one of the things that we're also changing at the same time is we're changing all varchar fields to nvarchar (don't ask me why).

After importing the data to the new 2008 database, I want to compare and validate the data. So I tried using the tablediff program that comes with SQL Server but it can't compare the two schemas due to the varchar/nvarchar difference.

This is the error I get:

Table [db1].[dbo].[table1] on server1 and Table [db2].[dbo].[table2] on server2 have different schemas and cannot be compared.

Is there a quick workaround to do this? If not, anyone have any suggestions that are free?

As an aside, it would be great if instead of comparing the entire table, I can compare only the rows with a certain condition (ie. where dates > 2009)

  • Isn't this question more suited for stackoverflow? – Milan Babuškov Jun 22 '09 at 17:37
  • I believe SO is for programming-related questions and since there's no programming involved here, I asked it here. But I can see what you're saying, DBA questions could really go either way. – Steve Aug 11 '09 at 17:26

If you want a utility to do this for you (and you can do it in a 14 day evaluation, or don't mind spending some money) Red Gate Software have excellent utilities SQL Compare (for schemas) and SQL Data Compare (for data).

(Thanks to squillman for pointing out I'd linked the wrong one!)

  • 2
    I think what you want is SQL Data Compare by RedGate. SQL Compare just does schemas, SQL Data Compare does the data. – squillman Jun 22 '09 at 17:27

Volpet software has a tool called Table Diff that does just this for SQL Server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.