批量更改数据类型并重命名相关存储过程变量
我正在优化数据库,并且正在考虑将表上某些列的数据类型从 DATETIME 更改为 SMALLDATETIME。
是否有一个系统存储过程返回存储过程的内容/代码和依赖表,然后允许我对过滤后的表列表进行联接?
干杯!
EDIT1:
我希望以编程方式重命名存储过程而不是跟踪依赖关系!
I am in the process of optimising my database and I was thinking of changing the datatype for some columns from DATETIME to SMALLDATETIME on my tables.
Is there a system stored procedure that returns both the contents/code of a store procedure and the dependent table which will then allow me to do a join on a filtered list of tables?
Cheers!
EDIT1:
Im looking to programatically rename the stored procedures not track dependencies!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SQL 的内置依赖性跟踪不太适合此类工作。 我想到了两个工具...
Red Gate 对他们的产品提供免费试用,这可能会帮助你完成这项工作
The built-in dependency tracking for SQL isn't very good for this type of work. Two tools come to mind thought...
Red Gate has a free trial on their stuff, which might get you through this job
我用我用来在存储过程(以及函数和视图)中查找文本的 scipt 示例回答了一个类似的问题(下面的链接)。 它需要一些工作,但可能会对您有所帮助。
[如何查找存储过程中的数据表列引用
[1]:http://How 在存储过程中查找数据表列引用程序
I answered a simliar question to this (link below) with a sample of a scipt I use to find text in stored procedures (and functions and views). It requires a bit of work, but might help you here.
[How to find data table column reference in stored procedures
[1]: http://How to find data table column reference in stored procedures
如果 SQL Server 中的依赖关系准确,则可以将 sys.sql_dependency 与适当的联接一起使用。
If your dependencies in SQL Server are accurate, you can use sys.sql_dependencies with appropriate joins.