简体   繁体   English

如何使用SQL Server中的隐藏数据库对象?

[英]How can I work with the hidden database objects in SQL Server?

I am working with a SQL Server that, for security reasons, does not show the database names, schemas, tables, and stored procedures on the server. 我正在使用SQL Server,出于安全原因,该服务器未在服务器上显示数据库名称,架构,表和存储过程。

I have permissions to alter and maintain the objects, just can't see them in SSMS. 我拥有更改和维护对象的权限,只是在SSMS中看不到它们。 I'd like to know an easy way to work with the database in the ways I am accustomed to working in SSMS. 我想以一种我习惯于在SSMS中工作的方式来了解一种使用数据库的简单方法。 Right-clicking in SSMS gives you so many options that allow productivity (especially the script to functions). 在SSMS中单击鼠标右键会为您提供很多选项,可以提高工作效率(尤其是脚本可以正常运行)。

How can I 1) create a quick list of stored procedures, and 2) quickly create a script to alter a selected stored procedure? 如何1)创建存储过程的快速列表,以及2)快速创建用于更改所选存储过程的脚本?

You can list the objects using 您可以使用列出对象

SELECT name from sys.objects where type = 'P'

That should show stored procedures. 那应该显示存储过程。 However, if the objects are hidden from you you may not be able to run this. 但是,如果对您隐藏了对象,则可能无法运行该对象。

Searching for 'U' will show you tables. 搜索“ U”将显示表格。

As for changing the stored procedures, you can run an ALTER PROCEDURE ... But you may need to write the script blind. 至于更改存储过程,可以运行ALTER PROCEDURE ...但是您可能需要盲写脚本。 Or as suggested by @TK Bruin use sp_helptext to generate the create script will give you the basis of the alter statement. 或者按照@TK Bruin的建议,使用sp_helptext生成创建脚本将为您提供alter语句的基础。

regarding your first question: 关于第一个问题:

SELECT * FROM sys.procedures
SELECT * FROM sys.tables

see Object Catalog Views (Transact-SQL) for more info 有关更多信息,请参见对象目录视图(Transact-SQL)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM