Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Meta Data FunctionsRSS Feeds

TYPEPROPERTY Function

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

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

TYPEPROPERTY function is used to get information about a data type.



Syntax of TYPEPROPERTY Function :

TYPEPROPERTY ( type, property )

type is a name of the data type. It is of type integer.

property is a property name. It can be of below values.

Property

Description

Returned Value

Precision

Precision for the data type.

The number of digits or characters.

NULL = Data type not found.

Scale

Scale for the data type.

The number of decimal places for the data type.

NULL = Data type is not numeric or not found.

AllowsNull

Data type allows null values.

1 = True
0 = False
NULL = Data type not found.

UsesAnsiTrim

ANSI padding setting was ON when the data type was created.

1 = True
0 = False
NULL = Data type not found, or it is not a binary or string data type.


Return type of TYPEPROPERTY function is an integer.




Examples of TYPEPROPERTY Function :

Example 1 : Use of TYPEPROPERTY function in select clause

SELECT TYPEPROPERTY( 'DateTime', 'AllowsNull' )

Output
1

Above example returns 1 means DateTime datatype allows null value.
  
Share: 

 
 

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

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