concept procedure in category sql server

appears as: procedures, procedure, procedure, The procedure, procedures
SQL Server MVP Deep Dives Vol. 2

This is an excerpt from Manning's book SQL Server MVP Deep Dives Vol. 2.

Often in their first attempts at a naming convention, developers will model naming conventions after what they’re seeing in the database. A good example of this are the stored procedures that are installed with SQL Server. These stored procedures begin with sp_ so many novice developers use this as their standard and will prefix their own stored procedures with sp_. But sp_ is a prefix that’s allocated to system stored procedures in SQL Server and means the stored procedure exists in the system databases (the master and the hidden resource database). Using the sp_ prefix could impact the performance of your stored procedures.

A simple stored procedure that gathers client information from a table could be named so many ways. When working on an application, how do developers know what stored procedure to call unless all the stored procedures are formatted the same, or unless they go back and search for the stored procedure in the database? For example, consider these names:

As a way to validate the procedure (see the next listing), many DBAs and developers would be satisfied to run the procedure with a simple EXEC, check the return value, and execute a SELECT * statement against the Customer table.

Listing 3. Not structured (wrong!) test approach
DECLARE @i INT EXEC @i = usp_RegisterCustomer '999-99-9999', 'Luciano Moreira', '1979-12-29', 'M', 'Married', '50000' PRINT @i SELECT * FROM dbo.Customer

After your manual tests are executed and with all results acceptable, the procedure is ready for production, simple as that. Am I right?

SQL Server 2008 Administration in Action

This is an excerpt from Manning's book SQL Server 2008 Administration in Action.

  • Perhaps the most dangerous SAC option, xp_cmdshell should remain disabled wherever possible. If you enable it, ensure the Server Proxy account is configured to limit permissions. SQL Server BOL contains a description of both the dangers of xp_cmdshell and the procedures for limiting the potential adverse effects if enabled.
  • There are several tools and techniques for monitoring database mirroring, including system stored procedures, catalog views, performance counters, and the GUI-based Database Mirroring Monitor.