Reputation:
Is it possible to enumerate the currently-defined session variables? I've been looking for the equivalent of
select * from sys.tables
for session variables, but I can't find a sys view that contains that information. I'm wondering if it's possible to spin through them and print them to the response window. I've got about 35+.
Upvotes: 0
Views: 1710
Reputation: 1841
Try out this DMV. It has all the current session variables plus their values. They are in columnar format, btw. This will return the info on your current connection:
select * from sys.dm_exec_sessions where session_id = @@SPID
Also, here is the Books online article to interpret the columns (e.g. ansi_defaults column = ANSI_DEFAULTS setting for the session):
http://msdn.microsoft.com/en-us/library/ms176013(SQL.90).aspx
Upvotes: 1
Reputation: 6479
No its not possible to retrieve that information from SQL Server.
Upvotes: 2