user47589
user47589

Reputation:

sql server enumerate current session variables

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

Answers (3)

Anon246
Anon246

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

Chris Chilvers
Chris Chilvers

Reputation: 6479

No its not possible to retrieve that information from SQL Server.

Upvotes: 2

callisto
callisto

Reputation: 5083

If you mean Session vars as in ASP.net, then NO.

Upvotes: -1

Related Questions