SQL SERVER – Stored Procedure Optimization Tips – Best Practices
OK!! Finally I have convinced myself to write some technical stuff in my personal blog.. anyhow we work in that industry right and spend most of our time and eventually life coding and reading about technology, so here you go guys my first ever blog on technology - Below are some of the tips to optimize Stored Procedure with making simple changes in the code. -Include SET NOCOUNT ON statement: With every SELECT and DML statement, the SQL server returns a message that indicates the number of affected rows by that statement. This information is mostly helpful in debugging the code, but it is useless after that. By setting SET NOCOUNT ON, we can disable the feature of returning this extra information. For stored procedures that contain several statements or contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost because network traffic is greatly reduced. CREATE PROC dbo.ProcName AS SET NOCOUNT ON; --Procedure code here SELECT column1 FROM dbo.Tbl...