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+.
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:
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