Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » System FunctionsRSS Feeds

SESSIONPROPERTY Function

Posted By: Sarita Patel     Category: SQL Server     Views: 1258

This article explains about SESSIONPROPERTY function in sql server with examples.

SESSIONPROPERTY function returns option settings which are set for the session.

SET options are figured by combining server-level, database-level, and user-specified options.


Syntax of SESSIONPROPERTY Function :

SESSIONPROPERTY (option)

option is a current option setting for this session. It can be of the below values.

Option

Description

ANSI_NULLS

Specifies whether the SQL-92 compliant behavior of equals (=) and not equal to (<>) against null values is applied.

1 = ON
0 = OFF

ANSI_PADDING

Controls the way the column stores values shorter than the defined size of the column, and the way the column stores values that have trailing blanks in character and binary data.

1 = ON
0 = OFF

ANSI_WARNINGS

Specifies whether the SQL-92 standard behavior of raising error messages or warnings for certain conditions, including divide-by-zero and arithmetic overflow, is applied.

1 = ON
0 = OFF

ARITHABORT

Determines whether a query is terminated when an overflow or a divide-by-zero error occurs during query execution.

1 = ON
0 = OFF

CONCAT_NULL_YIELDS_
NULL

Controls whether concatenation results are treated as null or empty string values.

1 = ON
0 = OFF

NUMERIC_ROUNDABORT

Specifies whether error messages and warnings are generated when rounding in an expression causes a loss of precision.

1 = ON
0 = OFF

QUOTED_IDENTIFIER

Specifies whether SQL-92 rules regarding the use of quotation marks to delimit identifiers and literal strings are to be followed.

1 = ON
0 = OFF

<Any other string>

NULL = Invalid input

 

Return type of SESSIONPROPERTY function is a sql_variant.




Examples of SESSIONPROPERTY Function :

Example 1 : Use of SESSIONPROPERTY function in select clause 

SELECT SESSIONPROPERTY('QUOTED_IDENTIFIER')

Output
1

Above example returns 1 means rule use of quotation marks to delimit identifiers and literal strings are to be followed is set on.
  
Share: 

 
 

Didn't find what you were looking for? Find more on SESSIONPROPERTY Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of SESSIONPROPERTY Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!