The @@OPTIONS global variable provides information about the current values of query-processing SET options. The SET options can be modified as a whole by using the sp_configure 'user options' configuration option. Each user has an @@OPTIONS global variable that represents the configuration environment. When first logging in, all users are assigned a default configuration environment that is set by the system administrator.
You can change the query-processing options by using the SET statement.
Values within @@OPTIONS are the same as the configuration values for 'user options' in sp_configure.
For more information, see SET Statement .
For more information about sp_configure 'user options', see sp_configure.
This example switches on the NOCOUNT option and then tests the value of @@OPTIONS. The NOCOUNT ON option prevents the number of rows affected message from being sent back to the requesting client for every statement in a session. The value of @@OPTION is set to 512 (0x0200), which represents the NOCOUNT option. The following statement tests whether the NOCOUNT option has been enabled on the client. For example, it can help to track down performance differences on a client machine.
SET NOCOUNT ON IF @@OPTIONS & 512 > 0 RAISERROR ('Current user has SET NOCOUNT turned on.',1,1)