|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Today @ 9:27 AM
Points: 466,
Visits: 8,719
|
|
|
|
|
|
Forum 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é
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 5:01 AM
Points: 4,815,
Visits: 1,343
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 5:02 AM
Points: 2,365,
Visits: 1,825
|
|
nice article
"Keep Trying"
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Today @ 9:15 AM
Points: 768,
Visits: 281
|
|
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...
|
|
|
|
|
Forum 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
|
|
|
|
|
Forum 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..
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, May 07, 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...
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Tuesday, October 23, 2012 11:34 AM
Points: 944,
Visits: 403
|
|
"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).
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 9:10 PM
Points: 26,
Visits: 263
|
|
| 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.
|
|
|
|