0

我使用SQL Server 2008 R2, 我有两个相同的DB,如何比较相同的数据库的架构和表?

  1. ABC(与像模式,表,但没有数据在 表只有结构)
  2. ABC1(与模式,表和表中的数据)

我如何比较#1 &#2的模式和表,我们是否有任何软件或者我们可以在SSMS本身做到这一点。

回答

1
You can write a sproc which will do this for you. 

1.Lets get all the tables from ABC into a table variable or temp table. 
2.Loop through the temp or table variable and get each table at a time. 
3.Get all the column names,datatypes etc for this table and similarly get the same details for the same table from ABC1 database. 
4.Also create one final result table where you just update the status against each table as match or nomatch 
5.Repeat this for all the tables in the table variable. 
+0

可以请你指导或帮我写 –

+0

ok.do你有这些dbs在同一台服务器上或不同的服务器上? – AnandPhadke

+0

它在同一台服务器即上(本地) –

0

您还可以尝试ApexSQL Diff - 一种SQL Server数据库比较和同步工具,用于检测数据库对象之间的差异。它产生于发现差异的综合报告,并可以自动实时和版本的数据库,备份,快照和脚本之间的同步处理文件夹

视频 - Introduction to ApexSQL Diff

声明:我ApexSQL工作作为支持工程师

相关问题