在两个数据库之间同步存储过程? [英] Syncing stored procedures between two databases?

查看:35
本文介绍了在两个数据库之间同步存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的团队正在开发的应用程序,我创建了一个数据库副本,以便独立处理系统的一些可能功能.在这样做的过程中,我更改了一些存储过程.同时,团队的其他成员继续在另一个数据库上工作并更改其中一些存储过程.

代码仍在调用相同的 SP 名称,因此我需要知道哪些存储过程已更改,以便进行正确的修复.有什么办法可以从一个数据库中取出所有存储过程,并将其与另一个数据库中同名的 SP 进行匹配,以查看哪些不同(除了 USES[DB1] 和 USES [DB2] 的区别).

谢谢

解决方案

大家好.我考虑了所有的回应,下载新软件对我来说不是一个选择.经过进一步研究,这就是我采用此解决方案的方式.

我只是在两个数据库中查询了所有存储过程及其最近更改日期的列表.然后我比较了他们的更改日期并手动查看了他们的来源并进行了更改.源代码控制肯定会对此有所帮助,但有时事情超出了我的控制范围.

获取我的所有 SP 名称和更改日期的列表的代码如下.

选择 ROUTINE_NAME, LAST_ALTERED来自 information_schema.routines在哪里Routine_Type='程序'AND specific_Catalog='DATABASE_NAME' ORDER BY LAST_ALTERED

For an app my team is developing, I have created a copy of the database to work independently on some possible features for the system. In doing so, I have changed some stored procedures. Meanwhile, other members of the team continue to work on the other database and change some of those stored procedures.

The code is still calling the same SP names, so I'll need to know which stored procedures have been changed in order to make the correct fixes. Is there any way to take all of the stored procedures from one database and match it against SPs with the same name in the other database, to see which are different (besides the USES[DB1] and USES [DB2] difference).

Thanks

解决方案

Hey all. I took all of the responses into consideration and downloading new software is not an option for me. Upon further research, this is how I went about this solution.

I simply queried both databases for a list of all stored procedures and their most recent alter date. I then compared their alter date and manually looked at their source and made my changes. Source control definitely would have helped with this, but sometimes things are out of my control.

The code to get a list of all of my SP names and alter dates is as follows.

select ROUTINE_NAME, LAST_ALTERED
from information_schema.routines
WHERE
Routine_Type='procedure'
AND specific_Catalog='DATABASE_NAME' ORDER BY LAST_ALTERED

这篇关于在两个数据库之间同步存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆