Peter Larsson Blog

Patron Saint of Lost Yaks

How to get current connection settings

SELECT  name AS Setting,
        CASE
            WHEN @@OPTIONS & number = number THEN 'ON'
            ELSE 'OFF'
        END AS Value
FROM    master..spt_values
WHERE   type = 'SOP'
        AND number > 0

Or this

SELECT  *
FROM    sys.dm_exec_sessions
WHERE   session_id = @@SPID

Or this

SELECT  *
FROM    sys.dm_exec_request
WHERE   session_id = @@SPID

Legacy Comments


Dugi
2010-03-20
re: How to get current connection settings
Yep simple, multi-alternative and nice script!

Paul Wehland
2010-03-21
re: How to get current connection settings
Tiny correction
You will need to plualize:

Select * from sys.dm_exec_requestS
WHERE session_id = @@SPID

Notice the S at the end of the table name

Rajen Shah
2010-03-29
re: How to get current connection settings
Ace solutions.

Just a note for people who are still on sql server 2000, only the 1st one will work.

Adam Machanic
2010-03-30
re: How to get current connection settings
DBCC USEROPTIONS

Called.com
2011-03-09
re: How to get current connection settings
I recently had a problem on my computer and it seemed that my whole system crashed. I created a new ip and now it seems that my pc is brand new! Thanks for the help!

EasyHairLossPrevention.com
2011-06-16
re: How to get current connection settings
I managed to solve my problem thanks to you and Rajen who commented above. He said the only the first one will work but i didn't see it at first and messed it up.