By default, SQL Server Setup installs the Embedded SQL for C (ESQL/C) sample source code in \Mssql7\DevTools\Samples\Esqlc.
Before you build any of the sample programs, you can use the Setenv.bat batch file to add the Microsoft® SQL Server™ development file header and library directories to the INCLUDE and LIB environment variables. Edit the Setenv.bat file to set the variables as appropriate for your system.
You can build any of the sample programs by using the supplied, general purpose makefile. The single makefile, Makefile, contains everything needed to build an Embedded SQL application.
The default values for Makefile arguments support building the samples as Microsoft Win32® console applications. Makefile arguments can be supplied in the command prompt, or they can be set as environment variables for rapid processing of several example source files. For example, SET SERVER=MyServer could be used to cause nsqlprep to use MyServer as the build target for ESQL/C stored procedure creation.
Makefile argument | Default value | Description |
---|---|---|
APP | Name of the sample source file to build. Do not include a file extension. | |
UTIL | Name of the utility source file. Do not include a file extension. The default value for the utility file is based on the value of the SUBSYS argument. | |
ENV | dos | Build sample for execution in Microsoft MS-DOS®. |
win16 | Build sample as a 16-bit Microsoft Windows® application. | |
qwin | Build console applications as 16-bit Windows, QuickWin applications. | |
win32i | Default. Build applications for 32-bit Windows operating systems. | |
MODEL | medium | When building a sample for MS-DOS or 16-bit Windows, build the sample for the medium memory model. |
large | Default. When building the sample for MS-DOS or 16-bit Windows, build the sample for large memory model. | |
SUBSYS | console | Default. Build sample as a console (command window) application. Specifying console causes the UTIL argument to default to gcutil. |
windows | Build the sample as a Windows application. Specifying windows causes the UTIL argument to default to gwutil. | |
DEBUG | 0 | Default. Build a release version of the sample. The executable does not contain debugger support. |
1 | Build a debug version of the sample. | |
SQLACCESS | 0 | Do not attempt to connect to a server running SQL Server and do not create stored procedures to support SQL statements embedded in C source code. Attempt to connect to a server running SQL Server and create stored procedures. |
1 | The default value of SQLACCESS is based on the presence or absence of a LOGIN argument value. Specifying SQLACCESS overrides the default assignment. | |
BIND | 0 | Default. Do not create a bind file. |
1 | Create a bind file. | |
SERVER | Name of the server running SQL Server to use for stored procedure creation. | |
LOGIN | SQL Server login identifier. The identifier is used by nsqlprep to connect to the server for stored procedure creation. | |
PASSWORD | SQL Server password. Used by nsqlprep to connect to the server. | |
DATABASE | SQL Server database nsqlprep will use when creating stored procedures. The default is pubs. |
For information about nmake command prompts that build a particular example, see the documentation for that example.
When started, each sample application accepts the following arguments for specifying the SQL Server installation: the login ID, password, and database to use. Each sample application generates a prompt for unspecified options.
program [{/s | /S} [server_name]]
[{/u | /U} login_id]
[{/p | /P} [password]]
[{/d | /D} database]