﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / Development  / How to compare two tables on different databases / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 03:54:39 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>After you get the first compare done, you could add an update_dt field and have it default to the current getdate() value. Then, if there are dates since the last comparison, then those are the ones that are different.There's also merge replication, once you got them in a spot where they are the same.The EXCEPT is the way I would make that first compare, too.</description><pubDate>Fri, 12 Jun 2009 07:13:02 GMT</pubDate><dc:creator>Randy-574768</dc:creator></item><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>Since databases are different, use fully qualified name of the databases i.e. prefix the table name with server IP.database.user.tableTo comapre the results, u can use EXCEPT operator.loke select * from d1..table1exceptselect * from d2..table2</description><pubDate>Thu, 11 Jun 2009 05:37:18 GMT</pubDate><dc:creator>arup chakraborty</dc:creator></item><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>its possible ........databases can be different ...for your second query : its very much possible..Very busy right now ....wil reply later ...till then do soem research :-)</description><pubDate>Thu, 11 Jun 2009 00:07:57 GMT</pubDate><dc:creator>hi_abhay78</dc:creator></item><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>One more thing If both table are not having same data then how will I make both tablles in sync ie same data in both table</description><pubDate>Wed, 10 Jun 2009 23:24:28 GMT</pubDate><dc:creator>jain_abhishek</dc:creator></item><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>but both the tables are in different database.how can  i compare</description><pubDate>Wed, 10 Jun 2009 23:19:28 GMT</pubDate><dc:creator>jain_abhishek</dc:creator></item><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>use tablediff utility : C:\Program Files\Microsoft SQL Server\90\COMgive source and destination [servername , tablename , databasename]..simple to use (consult BOL).make sure that the table has unique/primary key (clustered index)HTH</description><pubDate>Wed, 10 Jun 2009 23:18:57 GMT</pubDate><dc:creator>hi_abhay78</dc:creator></item><item><title>RE: How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>[quote][b]jain_abhishek (6/10/2009)[/b][hr]Hi I have two databases on same server and both databases.These do databases are same (we can say replica) .There is a table name 'Transactions' on both databases.Now I have to create a job which runs on daily basis and check whether the data in Table 'Transaction' in  both the databases is same or not (i.e to check whether table in both database is in sync) .How can I do this.Please suggest.[/quote]you can create a checksum for the values in the table (see checksum [url]http://msdn.microsoft.com/en-us/library/ms189788(SQL.90).aspx[/url]   and cheksum_agg ([url]http://msdn.microsoft.com/en-us/library/ms188920(SQL.90).aspx[/url]) and then compare the checksums. You can do this on a per row level (you may want to do this via a linked server), or the whole table. The fewer checksums you compare the less accurate the result will be (i.e. if you calculate a checksum for the whole table you may encounter cases where the checksums match, but the tables are different. You should also consider calculating the checksums based on some inside knowledge (e.g. do the checksums on only a few columns if that is sufficient to determine a difference). The checksum calculation may be expensive, so do some initial tests (like row counts). If you need to compare all the data without checksums, use either linked servers or there are third party tools too.Regards,  Andras</description><pubDate>Wed, 10 Jun 2009 23:06:13 GMT</pubDate><dc:creator>Andras Belokosztolszki</dc:creator></item><item><title>How to compare two tables on different databases</title><link>http://www.sqlservercentral.com/Forums/Topic732746-145-1.aspx</link><description>Hi I have two databases on same server and both databases.These do databases are same (we can say replica) .There is a table name 'Transactions' on both databases.Now I have to create a job which runs on daily basis and check whether the data in Table 'Transaction' in  both the databases is same or not (i.e to check whether table in both database is in sync) .How can I do this.Please suggest.</description><pubDate>Wed, 10 Jun 2009 22:36:24 GMT</pubDate><dc:creator>jain_abhishek</dc:creator></item></channel></rss>