Logo 
Search:

SQL Server Articles

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

GETANSINULL Function

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

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

GETANSINULL function returns the default nullability for the database for this session.

When the nullability of the given database allows null values and the column or data type nullability is not explicitly defined, GETANSINULL returns 1. This is the ANSI NULL default.

To activate the ANSI NULL default behavior, one of these conditions must be set:
  • sp_dboption 'database_name', 'ANSI null default', true
  • SET ANSI_NULL_DFLT_ON ON
  • SET ANSI_NULL_DFLT_OFF OFF

Syntax of GETANSINULL Function :

GETANSINULL ( [ 'database' ] )

database is the name of the database for which to return nullability information. It is of type char or nchar. 

Return type of GETANSINULL function is an integer. 




Examples of GETANSINULL Function :

Example 1 : Use of GETANSINULL function in select clause 

SELECT GETANSINULL ( 'northwinds' )

Output
1

Above example checks the default nullability for northwind database.
  
Share: 

 
 
 

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

Sarita Patel
Sarita Patel author of GETANSINULL 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!