@@OPTIONS

Transact-SQL Reference

Transact-SQL Reference

@@OPTIONS

Returns information about current SET options.

Syntax

@@OPTIONS

Return Types

integer

Remarks

SET options can be modified as a whole by using the sp_configure user options configuration option. Each user has an @@OPTIONS function that represents the configuration. When first logging on, all users are assigned a default configuration set by the system administrator.

You can change the language and query-processing options by using the SET statement.

Examples

This example sets NOCOUNT ON and then tests the value of @@OPTIONS. The NOCOUNT ON option prevents the message about the number of rows affected from being sent back to the requesting client for every statement in a session. The value of @@OPTIONS is set to 512 (0x0200), which represents the NOCOUNT option. This example tests whether the NOCOUNT option is enabled on the client. For example, it can help track performance differences on a client.

SET NOCOUNT ON
IF @@OPTIONS & 512 > 0 
   RAISERROR ('Current user has SET NOCOUNT turned on.',1,1)

See Also

Configuration Functions

sp_configure

user options Option