Why we use stored procedure than Sql statement?

A stored procedure is, as the name suggests, a query stored within the database that returns the results required to create the output you
want. This approach hides the structure of the database and tables from the user, as they just execute the stored procedure and get back a rowset (a series of rows of data) or whatever result the stored procedure is designed to generate. It is also more efficient because the database server can precompile the stored procedure, and reuse the compiled code. In addition, in enterprise-level databases, the administrator can
set access permissions on the tables so that users can only run a stored procedure, and not access the data in the tables directly.

There are also benefits from separating the user interface code (the Web Form) from the data access code when using a stored procedure. Providing that the stored procedure returns the same results, the actual structure of the underlying tables can change as required—without requiring any changes to the pages that access the data.

note : Wrox.ASP.dot.NET.2.0.Visual.Web.Developer.2005.Express.Edition.Starte
          chapter 3

你可能感兴趣的:(procedure)