Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Can you see stored procedures in sys.procedures?


Asked by Ian Ramirez on Dec 12, 2021 FAQ



Documenting a database and find that I cannot see stored procedures in sys.procedures, even though I can see them in Object Explorer. To ensure you can see the objects you are looking for: Make sure you are in the right database / right instance - seems simple and silly but it happens all the time.
One may also ask,
Let us see some of the Useful System Stored Procedures in SQL. These procedures will help you to extract the definition and dependencies of the existing stored procedures. The following three Sql Server System stored procedures are useful to deal with user-defined procedures:
Likewise, We can do this by query SQL Server’s meta data tables, which store information about an object’s modification. Two of the commonly used meta data tables are sys.objects and sys.procedures. You can use sys.proceedures to find the date of the most recent modification for stored procedures; SELECT [name], create_date, modify_date
Next,
Well, granting view definition to sys.procedures means you can say EXEC sp_helptext N'sys.procedures'; to view the definition of that stored procedure, not that you can select from it. And granting select to it would still hide from the results any object for which you don't have VIEW DEFINITION.
And,
The view contains one row per stored procedure, and the lifetime of the row is as long as the stored procedure remains cached. When a stored procedure is removed from the cache, the corresponding row is eliminated from this view.