Thursday, April 15, 2010

SQL Query to retun all TABLES, PROCEDURES and FUNCTIONS

-- Retuns all Tables in a database
-- Here U means User defined

SELECT [name],id,xtype FROM sysobjects WHERE xtype='U'

ORDER BY xtype DESC



-- Returns all Procedures

SELECT [name],id,xtype FROM sysobjects WHERE xtype='P'

ORDER BY xtype DESC



-- Returns all User Defined Functions

SELECT [name],id,xtype FROM sysobjects WHERE xtype IN ('TF', 'FN')

ORDER BY xtype DESC

No comments: