提示:如何在SQL Server数据库中获取对象列表

发布于 2025-02-09 00:43:56 字数 97 浏览 2 评论 0原文

有时,我已经完成了在SQL数据库的开发实例上的开发,经过几个测试周期,返工,调整等。

什么时候该在生产中移动所有内容时,我必须确保没有错误地遗忘(触发器,存储过程)。

sometimes I have completed the development of a solution on a development instance of a SQL database, after several test cycles, reworks, adjustments, etc.

When is time to move everything in production, I have to be sure that nothing is left behind by mistake (a trigger, a stored procedure).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

小矜持 2025-02-16 00:43:57

一个助手是获取数据库中所有对象的简单列表。

一个简单的查询以获取数据库中所有对象的列表是以下一个:

select * from Sys.objects as o left join sys.schemas as s on o.schema_id = s.schema_id
where is_ms_shipped = 0
order by s.name, o.type, o.name

您可以根据需要进行调整,删除字段等。

几个注意事项:

  1. 我排除了Microsoft(IS_MS_SHIPPED)提供的项目,
  2. 我加入了主系统表,其中包含所有对象的目录,并使用了架构的描述。这有助于

使用SSM(SQL Server Management Studio)订购所有元素,您可以轻松地将结果导出Excel,并在其上进行处理,将其添加到文档中。

One helper is to get a simple list of all the objects in the database.

A simple query to get the list of all the objects in your db is the following one:

select * from Sys.objects as o left join sys.schemas as s on o.schema_id = s.schema_id
where is_ms_shipped = 0
order by s.name, o.type, o.name

You can adjust it at your needs, remove fields, and so on.

Few notes:

  1. I have excluded items delivered by Microsoft (is_ms_shipped)
  2. I have joined the main system table with a catalogue of all the objects with the description of the schema. This is helpful to order all the elements

Using SSMS (SQL Server Management Studio), you can easily export the results in Excel, and work on it, add it to the documentation.

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