Unable to run diff on extracted tables

Automate and integrate using the SQL comparison API

Moderators: Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

Unable to run diff on extracted tables

Postby SQLAdminCJ » Thu Aug 30, 2012 7:33 am

Hey all,

I am trying to troubleshoot an exception that the data diff program that I wrote has been giving me.Hey all,

I am trying to troubleshoot an exception that the data diff program that I wrote has been giving me on a client's server. Their database is very large, and the error is caused during the process of running the commands to sync a specific table. There is a slightly different version of the database on each of 2 servers.

Rather than bring all of both databases back to my dev environment, I decided to create a new database on each server, and copy only the specific table into the new database using select into.

Since there were 2 servers, this means I had two of these databases containing only this one table. I brought them back to the office and ran my utility, but the table differences are coming back null even though at the client site itself it shows many differences.

Does anyone have any idea of what could be going on? What am I not transferring when copying the table using select into that is necessary to diff the two tables? I would appreciate any advice that anyone can provide. Thanks.
SQLAdminCJ
 
Posts: 10
Joined: Wed Dec 28, 2011 2:03 am

Found out what happened

Postby SQLAdminCJ » Fri Aug 31, 2012 12:37 am

Hey all,

I found out why the diff wasn't working when the tables was copied via this method; the primary key on the table is not preserved.

This leads to the question: is there a way to copy the tables I want to compare to a new database? Ideally, I could do this relatively easily using the GUI as opposed to bulk copy. Or, I suppose I could set the primary keys on the tables manually.

Let me know if you have any ideas. Thanks.
SQLAdminCJ
 
Posts: 10
Joined: Wed Dec 28, 2011 2:03 am

Postby Chris Auckland » Fri Aug 31, 2012 1:50 pm

Thanks for your post.

When you do a select into, I think it only adds the basic column structure and doesn't add any other structural information like indexes, permissions etc. If you want to copy the complete structure of the table you could use the SQL Compare API to deploy the table to the target database. After you have deployed the structure of the table you can use the SQL Data Compare API for the data. The SQL Compare / SQL Data Compare UI or command line might be useful for this if you don't need to include it in your own application.

I hope this helps.
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.


Return to SQL Comparison SDK 10

Who is online

Users browsing this forum: No registered users and 0 guests