Which system stored procedures do you use?

I realise this is subjective, but I figure some discussion on here can't be a bad thing!

The system stored procedures are pushed into the following categories in MSDN:

  • Active Directory Stored Procedures
  • Catalog Stored Procedures
  • Change Data Capture Stored Procedures
  • Cursor Stored Procedures
  • Database Engine Stored Procedures
  • Database Mail and SQL Mail Stored Procedures
  • Database Maintenance Plan Stored Procedures
  • Distributed Queries Stored Procedures
  • Full-Text Search Stored Procedures
  • Log Shipping Stored Procedures
  • Automation Stored Procedures
  • Policy-Based Management Stored Procedures
  • Replication Stored Procedures
  • Security Stored Procedures
  • SQL Server Profiler Stored Procedures
  • SQL Server Agent Stored Procedures
  • XML Stored Procedures
  • General Extended Stored Procedures

Which of those categories do you make use of?

more ▼

asked Nov 23, 2009 at 08:55 PM in Default

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.5k 61 65 87

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

for DBA code I love sp_msforeachdb and sp_msforeachtable

more ▼

answered Nov 24, 2009 at 12:39 AM

nkav gravatar image

101 1 1 2

Ahh yes! Matt you missed off one important category : Undocumented! :)
Nov 25, 2009 at 05:46 AM Kev Riley ♦♦
(comments are locked)
10|1200 characters needed characters left

I guess I would probably use these every week.....

Database Engine Stored Procs

  • attach / detach
  • sp_helpXXXX
  • sp_who(2)

Database Mail

  • sending mail

Security Stored Procs

  • adding users/roles etc

SQL Server Profiler Stored Procs

  • server side tracing

SQL Server Agent Stored Procs

  • job creation and management

General Extended Stroed Procs

  • xp_cmdshell !!!
more ▼

answered Nov 24, 2009 at 06:15 AM

Kev Riley gravatar image

Kev Riley ♦♦
53.8k 47 49 76

I upvoted this, but I missed the xp_cmdshell reference with the exclamation points. I don't use it and have it disabled on my 2005/2008 servers. If I need to do something at the Command Line level I just think SQL Server isn't the right place for it.
Nov 25, 2009 at 01:39 AM Jack Corbett
Jack: I agree about it being disabled and it is on my production boxes, but I do use it for admin tasks. In my scripts I test for the version, and if its 9 or above, turn on xp_cmdshell, do what I need to do (create folders or whatever), then turn it off again. It certainly isn't used by any application code! Me ONLY!
Nov 25, 2009 at 04:56 AM Kev Riley ♦♦
(comments are locked)
10|1200 characters needed characters left

I am currently working on some back-end code to generate views, format files, etc. from metadata, and sp_executesql has been quite useful.

more ▼

answered Nov 23, 2009 at 10:50 PM

Tom Staab gravatar image

Tom Staab
5.8k 6 8 10

I forgot to mention I also frequently use sp_help and sp_helptext.
Nov 24, 2009 at 12:33 PM Tom Staab
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Nov 23, 2009 at 08:55 PM

Seen: 1297 times

Last Updated: Nov 23, 2009 at 08:55 PM