批量更改数据类型并重命名相关存储过程变量

发布于 2024-07-27 03:58:30 字数 184 浏览 4 评论 0原文

我正在优化数据库,并且正在考虑将表上某些列的数据类型从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

污味仙女 2024-08-03 03:58:30

SQL 的内置依赖性跟踪不太适合此类工作。 我想到了两个工具...

  1. Red Gate SQL 依赖跟踪器 - 适合确定所有依赖代码
  2. Visual Studio for Database Developers - 包含 TSQL 代码分析,可以识别一段数据是否被视为不正确的类型。

Red Gate 对他们的产品提供免费试用,这可能会帮助你完成这项工作

The built-in dependency tracking for SQL isn't very good for this type of work. Two tools come to mind thought...

  1. Red Gate SQL Dependency Tracker - Good for determining all the dependent code
  2. Visual Studio for Database Developers - Contains TSQL Code Analysis which can identify if a piece of data is being treated as an incorrect type.

Red Gate has a free trial on their stuff, which might get you through this job

つ可否回来 2024-08-03 03:58:30

我用我用来在存储过程(以及函数和视图)中查找文本的 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

长亭外,古道边 2024-08-03 03:58:30

如果 SQL Server 中的依赖关系准确,则可以将 sys.sql_dependency 与适当的联接一起使用。

If your dependencies in SQL Server are accurate, you can use sys.sql_dependencies with appropriate joins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文