Get All SESSIONPROPERTY Values for Your Session

As a follow-up to my SERVERPROPERTY() post, this is a quick script to grab all the SESSIONPROPERTY() values from your current session in a table. Useful when you forget what the propertyname options are. Properties obtained from http://msdn.microsoft.com/en-us/library/ms175001.aspx.

DECLARE @props TABLE (propertyname sysname PRIMARY KEY)
INSERT INTO @props(propertyname)
SELECT 'ANSI_NULLS'
UNION ALL
SELECT 'ANSI_PADDING'
UNION ALL
SELECT 'ANSI_WARNINGS'
UNION ALL
SELECT 'ARITHABORT'
UNION ALL
SELECT 'CONCAT_NULL_YIELDS_ NULL'
UNION ALL
SELECT 'NUMERIC_ROUNDABORT'
UNION ALL
SELECT 'QUOTED_IDENTIFIER'
 
SELECT propertyname, SESSIONPROPERTY(propertyname) FROM @props

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.