请大家推荐一个数据库的表结构或表内容对比工具

大风吹过脸颊 2015-11-24 01:41:08
请大家推荐一个数据库的表结构或表内容对比工具。

要中文,对比能直观明了,简单好用。能导出sql语句就更好了。
...全文
3354 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
polocode 2018-04-20
  • 打赏
  • 举报
回复
这个不也就是ampnmp.DatabaseCompare的功能吗,比较两个数据库全部表结构的差异, 包括表名、存储引擎、字符集、注释的不同, 以及每张表中的字段名、数据类型、字符集、默认值、注释的不同, 还有索引的不同、字段顺序的不同。
victorlv2010 2017-06-01
  • 打赏
  • 举报
回复
用杭州深普科技公司开发的DCSTAR数据库一致性校验和保障软件,可以很好的进行数据库数据比对和结构比对,http://www.deepdt.com/production, 比oracle 的veridata好很多,真正的国产化软件,值得推荐。
swordmanli 2016-09-13
  • 打赏
  • 举报
回复
http://download.csdn.net/detail/swordmanli/9629605
holdingsword 2015-11-30
  • 打赏
  • 举报
回复
/*--调用示例 exec USP_Comp_Table 'DBNAME1','DBNAME2' --*/ CREATE proc USP_Comp_Table @dbname1 varchar(250),--要比较的数据库名1 @dbname2 varchar(250) --要比较的数据库名2 as create table #tb1(表名1 varchar(250),字段名 varchar(250),序号 int,标识 bit,主键 bit,类型 varchar(250), 占用字节数 int,长度 int,小数位数 int,允许空 bit,默认值 sql_variant,字段说明 sql_variant) create table #tb2(表名2 varchar(250),字段名 varchar(250),序号 int,标识 bit,主键 bit,类型 varchar(250), 占用字节数 int,长度 int,小数位数 int,允许空 bit,默认值 sql_variant,字段说明 sql_variant) --得到数据库1的结构 exec('insert into #tb1 SELECT 表名=d.name,字段名=a.name,序号=a.colid, 标识=case when a.status=0x80 then 1 else 0 end, 主键=case when exists(SELECT 1 FROM '+@dbname1+'..sysobjects where xtype=''PK'' and parent_obj=a.id and name in ( SELECT name FROM '+@dbname1+'..sysindexes WHERE indid in( SELECT indid FROM '+@dbname1+'..sysindexkeys WHERE id = a.id AND colid=a.colid ))) then 1 else 0 end, 类型=b.name,占用字节数=a.length,长度=a.prec,小数位数=a.scale,允许空=a.isnullable, 默认值=isnull(e.text,''''),字段说明=isnull(g.[value],'''') FROM '+@dbname1+'..syscolumns a left join '+@dbname1+'..systypes b on a.xtype=b.xusertype inner join '+@dbname1+'..sysobjects d on a.id=d.id and d.xtype=''U'' and d.name <>''dtproperties'' left join '+@dbname1+'..syscomments e on a.cdefault=e.id left join sys.extended_properties g ON a.ID=g.major_id AND a.COLID=g.minor_id order by a.id,a.colorder') --得到数据库2的结构 exec('insert into #tb2 SELECT 表名=d.name,字段名=a.name,序号=a.colid, 标识=case when a.status=0x80 then 1 else 0 end, 主键=case when exists(SELECT 1 FROM '+@dbname2+'..sysobjects where xtype=''PK'' and parent_obj=a.id and name in ( SELECT name FROM '+@dbname2+'..sysindexes WHERE indid in( SELECT indid FROM '+@dbname2+'..sysindexkeys WHERE id = a.id AND colid=a.colid ))) then 1 else 0 end, 类型=b.name,占用字节数=a.length,长度=a.prec,小数位数=a.scale,允许空=a.isnullable, 默认值=isnull(e.text,''''),字段说明=isnull(g.[value],'''') FROM '+@dbname2+'..syscolumns a left join '+@dbname2+'..systypes b on a.xtype=b.xusertype inner join '+@dbname2+'..sysobjects d on a.id=d.id and d.xtype=''U'' and d.name <>''dtproperties'' left join '+@dbname2+'..syscomments e on a.cdefault=e.id left join sys.extended_properties g ON a.ID=g.major_id AND a.COLID=g.minor_id order by a.id,a.colorder') --and not exists(select 1 from #tb2 where 表名2=a.表名1) select 比较结果=case when a.表名1 is null and b.序号=1 then '库1缺少表:'+b.表名2 when b.表名2 is null and a.序号=1 then '库2缺少表:'+a.表名1 when a.字段名 is null and exists(select 1 from #tb1 where 表名1=b.表名2) then '库1 ['+b.表名2+'] 缺少字段:'+b.字段名 when b.字段名 is null and exists(select 1 from #tb2 where 表名2=a.表名1) then '库2 ['+a.表名1+'] 缺少字段:'+a.字段名 when a.标识 <>b.标识 then '标识不同' when a.主键 <>b.主键 then '主键设置不同' when a.类型 <>b.类型 then '字段类型不同' when a.占用字节数 <>b.占用字节数 then '占用字节数' when a.长度 <>b.长度 then '长度不同' when a.小数位数 <>b.小数位数 then '小数位数不同' when a.允许空 <>b.允许空 then '是否允许空不同' when a.默认值 <>b.默认值 then '默认值不同' when a.字段说明 <>b.字段说明 then '字段说明不同' else '' end, * from #tb1 a full join #tb2 b on a.表名1=b.表名2 and a.字段名=b.字段名 where a.表名1 is null or a.字段名 is null or b.表名2 is null or b.字段名 is null or a.标识 <>b.标识 or a.主键 <>b.主键 or a.类型 <>b.类型 or a.占用字节数 <>b.占用字节数 or a.长度 <>b.长度 or a.小数位数 <>b.小数位数 or a.允许空 <>b.允许空 or a.默认值 <>b.默认值 or a.字段说明 <>b.字段说明 order by isnull(a.表名1,b.表名2),isnull(a.序号,b.序号) --isnull(a.字段名,b.字段名)
Q315054403 2015-11-29
  • 打赏
  • 举报
回复
这么多人都要这个...考虑写个得了
zhll2046 2015-11-27
  • 打赏
  • 举报
回复
这个MS官方就有工具啊,Visual Studio 如何:比较数据库架构 https://msdn.microsoft.com/ZH-CN/library/aa833435%28v=vs.100%29.aspx
--小F-- 2015-11-24
  • 打赏
  • 举报
回复
一般都是直接对比的 现在市面上的这些第三方对比工具大部分都是收费的。
大风吹过脸颊 2015-11-24
  • 打赏
  • 举报
回复
引用 1楼--小F-- 的回复:
一般都是直接对比的 现在市面上的这些第三方对比工具大部分都是收费的。
怎么个直接对比法

34,587

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧