SELECT name AS spname FROM sysobjects WHERE xtype = 'p' ORDER BY name
xtype是sysobjects表中的一列, 其中存储的是对象的类型. 从上面的语句可以看出'p'代表的是存储过程, 那么其他的类型呢?
以下是xtype的部分列表.
- C = CHECK constraint
- D = Default or DEFAULT constraint
- F = FOREIGN KEY constraint
- L = Log
- P = Stored procedure
- PK = PRIMARY KEY constraint (type is K)
- RF = Replication filter stored procedure
- S = System table
- TR = Trigger
- U = User table
- UQ = UNIQUE constraint (type is K)
- V = View
- X = Extended stored procedure
- FN = Function
资料来源:
Get All the Stored Procedure Names In One Shot
http://www.devx.com/tips/Tip/27129
Use Sysobjects in SQL Server to Find Useful Database Information