Is there a query that returns the names of all the stored procedures in an MS SQL database (excluding "System Stored Procedures" would be a nice touch)?
views:
7081answers:
10From my understanding the "preferred" method is to use the information_schema tables:
select * from information_schema.routines where routine_type = 'PROCEDURE'
As Mike stated, the best way is to use information_schema. As long as you're not in the master database, system stored procedures won't be returned.
select * from DatabaseName.information_schema.routines where routine_type = 'PROCEDURE'
If for some reason you had non-system stored procedures in the master database, you could use the query (this will filter out MOST system stored procedures):
select * from master.information_schema.routines where routine_type = 'PROCEDURE' and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')
sql server 2005 has views that let you grab sprocs, parameters, tables, columns etc.
Its all built in now!
Unfortunately INFORMATION_SCHEMA doesn't contain info about the system procs.
SELECT *
FROM sys.objects
WHERE objectproperty(object_id, N'IsMSShipped') = 0
AND objectproperty(object_id, N'IsProcedure') = 1
If you are using SQL Server 2005 the following will work:
select * from sys.procedures where is_ms_shipped = 0
i tried the above query in sql server 2005. its giving invalid object name sys.procedures
Hi
Can u tell me how can i get Store proc execution Time and it executed by whom (log details)