SQL 查找存储过程及视图与自带函数

时间:2023-03-08 20:42:56
查找所有所有存储过程的名称及信息
select * from sysobjects
where type='P' 查看存储过程定义语句
sp_helptext [存储过程名] 查看所有视图及信息
select * from sysobjects
where type='V' SQL自带函数
exec sp_databases; --查看数据库
exec sp_tables;        --查看表
exec sp_columns student;--查看列
exec sp_helpIndex student;--查看索引
exec sp_helpConstraint student;--约束
exec sp_stored_procedures;
exec sp_helptext 'sp_stored_procedures';--查看存储过程创建、定义语句
exec sp_rename student, stuInfo;--修改表、索引、列的名称
exec sp_renamedb myTempDB, myDB;--更改数据库名称
exec sp_defaultdb 'master', 'myDB';--更改登录名的默认数据库
exec sp_helpdb;--数据库帮助,查询数据库信息
exec sp_helpdb master;