Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 37: SQL Server as an Access Companion


1219


FIGURE 37.21

A SQL Server view is equivalent to an Access datasheet.


Stored procedures
Although superficially similar to Access queries, SQL Server stored procedures often perform sig-
nificant data processing at the database engine level. SQL Server’s SQL dialect is capable of loop-
ing, using variables and temporary tables, calling any of hundreds of different built-in SQL Server
functions (such as returning the current date and time), and performing many other tasks.

Note
Stored procedures, functions, and triggers are not queries. A stored procedure is a block of SQL statements
that are executed as a single entity.


One use of stored procedures is as handy containers for storing the SQL statements used through-
out an application. Instead of writing SQL statements in your application code, you can store them
in the database as stored procedures, calling them from your code in much the same way that you
call a VBA function. Here are some of the many benefits of stored procedures:

l (^) They can contain multiple SQL statements.
l They can call another stored procedure.
l (^) They can receive parameters and return a value or a result set.

Free download pdf