Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 1234»»»

Finding and Listing ALL Procedures, Functions, and Views in SQL Server 2005 Expand / Collapse
Author
Message
Posted Saturday, July 26, 2008 11:30 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 8:00 AM
Points: 473, Visits: 8,737
Comments posted to this topic are about the item Finding and Listing ALL Procedures, Functions, and Views in SQL Server 2005

~ Without obstacles, you cannot progress ~
http://sqln.blogspot.com/
Post #541425
Posted Monday, July 28, 2008 1:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, May 17, 2013 12:43 AM
Points: 3, Visits: 57
When I read this it made me think of a procedure we use from Codeplex: http://www.codeplex.com/ScriptDB

We run it nightly to scripts all databases, procedures, triggers, indexes, etc.. Obviously this is very good as a backup alternative, but if you dump this regularly, you can also use this to quickly find back that previous version of a stored procedure you just (accidentally) overwrote :)
great for inclusion in SVN.

René

Post #541634
Posted Monday, July 28, 2008 2:20 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 1:47 AM
Points: 5,449, Visits: 1,401
Nice one ...:)


Post #541650
Posted Monday, July 28, 2008 2:21 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 8:08 AM
Points: 2,365, Visits: 1,846
nice article

"Keep Trying"
Post #541651
Posted Monday, July 28, 2008 2:32 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 2:32 AM
Points: 850, Visits: 337
Sorry, but this part...

One last note, if you want to create an SP and have it distributed (automatically included) with all databases you create then you will want to create the SP for the 'master' database. Also, this only gets used with newly created databases from the point after you created the SP...So, if you already have existing databases you will still have to create the SP for each one of them.

...doesn't make sense.
It would make sense if instead of master you would write model.

Nice article and I am currently testing things...
Post #541656
Posted Monday, July 28, 2008 2:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, January 11, 2013 7:51 AM
Points: 9, Visits: 68
sometimes when i'm searching for a particular procedure....i use the following:


use [your DB here]
GO

SELECT Distinct SO.Name
FROM sysobjects SO (NOLOCK)
INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID
AND SO.Type = 'P'
AND SC.Text LIKE '%YOUR SEARCH TEXT HERE e.g. TABLENAME%'
ORDER BY SO.Name
Post #541665
Posted Monday, July 28, 2008 3:45 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 10, 2009 6:42 AM
Points: 1, Visits: 15
I believe using information_schema.routines is still a better idea, code using this will work across SQL server versions..
Post #541697
Posted Monday, July 28, 2008 6:33 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, May 7, 2012 9:23 AM
Points: 304, Visits: 716
Thanks very much for this informative and helpful article. Just last week we were discussing cleaning up our test/development database and this information is timely and very handy. Great work!



There's no such thing as dumb questions, only poorly thought-out answers...
Post #541827
Posted Monday, July 28, 2008 7:12 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 1:18 PM
Points: 944, Visits: 451
"SQL Server 2005 only stores the identifying information of a SP."

actually, SQL05 DOES store the code of the object itself as well. it can be found in sys.sql_modules, and a join can be used from sys.all_objects to sys.sql_modules on object_id. there are some catches though, so you may not get to see the code for ALL objects (especially system objects).
Post #541863
Posted Monday, July 28, 2008 8:55 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, September 8, 2014 8:18 AM
Points: 26, Visits: 265
Although I agree that using 'sys.' views is a better way to get information, I have used the text column of the syscomments table directly in the past to get the DDL (data description language) for the script-level definitions of stored procedures, views, default values, etc. I do not use this table (directly) for production level code.
Post #541956
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse