Access Plan and Bind File Options

By using the /DB and /PASS options with the sqlprep precompiler, you can connect to a specified server and database and create an access plan (set of stored procedures) for each separately compiled program module (compilation unit). With the /DB and /PASS options, sqlprep makes a connection using the specified server name, database name, login ID, and password. The access plan consists of a separate stored procedure for each static SQL statement in each compiled program module.

By default, the stored procedure names consist of the following:

The date/timestamp provides for re-creating stored procedures for the access plan with identical program module names each time the program is compiled. However, if you use the /PLAN option and specify a non-default plan name that ends with an underscore (_), sqlprep does not include the date/timestamp in the stored procedure names. You can, therefore, reuse the stored procedures that were created from a previous precompile.

If the database you need to connect to is unavailable, or you do not want to use it, when you are ready to compile, you can use the /BIND option in the sqlprep precompiler command line to create a bind file. The bind file is a Transact-SQL script that is used to create stored procedures for access plans. You can later use the SQL Server isql utility to apply the bind file to the database. However, to run a bind file as a SQL script, each line must contain no more than 1,000 characters if you want to use the isql utility. If one or more lines contain more than 1,000 characters, use the isqlw utility. You must apply the bind file to the database before you can run the corresponding C application.

If you do not specify the /DB and /PASS options or the /BIND option, static SQL statements are issued at run time, as are dynamic SQL statements.