How to Decode @@OPTIONS Value? – Interview Question of the Week #268


 

There are situations where set options can change the query behavior of a session. The session-level options can be found using the @@options variable in SQL Server. In this blog, I am sharing a useful script which can be used to decode the value of this global variable.

There are multiple ways and formats to get the output. I found the below query in profiler which I was capturing it for some other blog.

If you have a need to get connection options set as default (in below screen). This is the property window of the server.

Here is the query.

DECLARE @ServerUserOption INT