Stored Procedures vs. Direct SQL


Most code fragments shown in this document use SqlCommand objects to call stored procedures to perform database manipulation. In some cases, you will not see the SqlCommand object because the stored procedure name is passed directly to a SqlDataAdapter object. Internally, this still results in the creation of a SqlCommand object.
You should use stored procedures instead of embedded SQL statements for a number of reasons:
The SQL Server online documentation strongly recommends that you do not create any stored procedures using "sp_" as a name prefix because such names have been designated for system stored procedures. SQL Server always looks for stored procedures beginning with sp_ in this order:
  1. Look for the stored procedure in the master database.
  2. Look for the stored procedure based on any qualifiers provided (database name or owner).
Look for the stored procedure, using dbo as the owner if an owner is not specified.



Shashi Ray