h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

SQL SERVER – Stored Procedure Optimization Tips – Best Practices


  • Include SET NOCOUNT ON statement
  • Use schema name with object name
  • Do not use the prefix “sp_” in the stored procedure name
  • Use IF EXISTS (SELECT 1) instead of (SELECT *)
  • Use the sp_executesql stored procedure instead of the EXECUTE statement
  • Try to avoid using SQL Server cursors whenever possible
  • Keep the Transaction as short as possible
  • Use TRY-Catch for error handling