How To Compare Two SQL Server Databases Without Any Software
I’m glad to inform that today im going to release my next phase of TsqlTools is SQLCOMPARE. I was in a point to compare two databases which are on two different servers, I have checked many websites and blogs, but unfortunately, I didn’t find any useful T-SQL query for that. But there is so many good software available to compare the databases. Red-Gate is one of my favorite tool for comparison.
So I have prepared 3 Tsql scripts to compare all databases objects between two SQL servers.
- Objects Compare
- Index Compare
- RowCount Compare
How to Run this query?
You can use a centralized Server and create LinkedServers for Source and Target DB servers,
or
Create a LinkedServer for Target server on SourceDB server, then run the query on Source DB server.
Download the Script Here:
Database Engineer
3 个月More than 7yrs later, and this article (scripts included) is very helpful. Used sp_serveroption stored procedure to connect to my remote server, and everything worked well.