******************查看数据库中的所有视图名********************** select * from sysobjects where xtype='V' **********************************************************************************查看数据库中的所有触发器名********************** select * from sysobjects where xtype='TR' **********************************************************************************查看数据库中的所有存储过程名********************** select * from sysobjects where xtype='P' **************************************************************** *******************显示数据库表名-----开始******************** select * from sysobjects where xtype ='u' *******************显示数据库表名-----结束********************
EXEC sp_helptrigger 'dbo.aaaaaaaaaaaaa'
select * from sysobjects where xtype='TR' and name ='表名'
select B.name from sysobjects A,sysobjects B where A.xtype ='TR' and A.parent_obj = B.id
哪里可以看出来有触发器? sp_help 'tb'Name Owner Type Created_datetime -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ------------------------------- ----------------------- tb dbo user table 2010-08-30 16:15:11.170
Column_name Type Computed Length Prec Scale Nullable TrimTrailingBlanks FixedLenNullInSource Collation -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ----------------------------------- -------------------------------------------------------------------------------------------------------------------------------- id int no 4 10 0 yes (n/a) (n/a) NULL Identity Seed Increment Not For Replication -------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- --------------------------------------- ------------------- No identity column defined. NULL NULL NULL RowGuidCol -------------------------------------------------------------------------------------------------------------------------------- No rowguidcol column defined. Data_located_on_filegroup -------------------------------------------------------------------------------------------------------------------------------- PRIMARY 对象 'tb' 没有任何索引,或者您没有所需的权限。
******************查看数据库中的所有视图名**********************
select * from sysobjects where xtype='V'
**********************************************************************************查看数据库中的所有触发器名**********************
select * from sysobjects where xtype='TR'
**********************************************************************************查看数据库中的所有存储过程名**********************
select * from sysobjects where xtype='P'
****************************************************************
*******************显示数据库表名-----开始********************
select * from sysobjects where xtype ='u'
*******************显示数据库表名-----结束********************
select B.name
from sysobjects A,sysobjects B
where A.xtype ='TR' and A.parent_obj = B.id
sp_help 'tb'Name Owner Type Created_datetime
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ------------------------------- -----------------------
tb dbo user table 2010-08-30 16:15:11.170
Column_name Type Computed Length Prec Scale Nullable TrimTrailingBlanks FixedLenNullInSource Collation
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ----------------------------------- --------------------------------------------------------------------------------------------------------------------------------
id int no 4 10 0 yes (n/a) (n/a) NULL
Identity Seed Increment Not For Replication
-------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- --------------------------------------- -------------------
No identity column defined. NULL NULL NULL
RowGuidCol
--------------------------------------------------------------------------------------------------------------------------------
No rowguidcol column defined.
Data_located_on_filegroup
--------------------------------------------------------------------------------------------------------------------------------
PRIMARY
对象 'tb' 没有任何索引,或者您没有所需的权限。
未给对象 'tb' 定义任何约束,或者您没有所需的权限。
没有外键引用表 'tb',或者您没有引用表的相关权限。
所有具有架构绑定的视图均未引用表 'tb'。