Export (0) Print
Expand All

SET OPTION

SQL Server 2000

  New Information - SQL Server 2000 SP3.

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 $integrated;
// 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. //

Security Note  The preceding example uses the $integrated keyword to enable Windows Authentication. When possible, use this authentication method. If Windows Authentication is not available, prompt users to enter their credentials at run time. Avoid storing credentials in a file. If you must persist credentials, you should encrypt them with the Win32 cryptoAPI.

See Also

Using Host Variables

Show:
© 2014 Microsoft