Dela via


@@OPTIONS (Transact-SQL)

Returns information about the current SET options.

Topic link iconTransact-SQL Syntax Conventions

Syntax

@@OPTIONS

Return Types

integer

Remarks

SET options can be modified as a whole by using the sp_configureuser 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

The following example sets NOCOUNTON and then tests the value of @@OPTIONS. The NOCOUNTON 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). This 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)