SET OPTION

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

SET OPTION

The SET OPTION statement sets values for query-processing options for Microsoft® SQL Server™ 2000.

Syntax

SET OPTION {QUERYTIME | LOGINTIME | APPLICATION | HOST} value

Arguments

QUERYTIME

Specifies the number of seconds that DB-Library waits for SQL Server to respond to a Transact-SQL statement. The default value is 0 seconds, meaning forever. This option is functionally the same as the DB-Library dbsettime function.

LOGINTIME

Specifies the number of seconds that DB-Library waits for SQL Server to respond to a request for a DBPROCESS connection. The default value is 10 seconds. This option is functionally the same as the DB-Library dbsetlogintime function.

APPLICATION

Specifies the application name in the LOGINREQ structure. This option supports a character value only (not numerical). This option is functionally the same as the DB-Library DBSETLAPP function.

HOST

Specifies the workstation name in the LOGINREQ structure. This option supports a character value only (not numerical). This option is functionally the same as the DB-Library DBSETLHOST function.

value

Is the valid numerical time-out value, in seconds, for the QUERYTIME or LOGINTIME DB-Library option. It is also the valid character value for the APPLICATION or HOST DB-Library option. value can be a character literal or a host variable.

Remarks

The remaining DB-Library options either do not apply to Embedded SQL (for example, row buffering) or can be set by using Transact-SQL statements.

Examples
EXEC SQL SET OPTION LOGINTIME 5;
EXEC SQL CONNECT TO caffe.pubs USER sa;
// If login to the server "caffe" does not occur within five //
// seconds, the "connect" attempt times out and SQL Server returns to the program. //
EXEC SQL SET OPTION QUERYTIME 2;
EXEC SQL SELECT name FROM sysobjects INTO :name;
// If the query response does not occur within two seconds, //
// the query attempt times out and returns to the program. //

See Also

Using Host Variables