Home > SQL Server > Get column or parameter property using ColumnProperty – SQL Server

Get column or parameter property using ColumnProperty – SQL Server


ColumnProperty() : This function returns the property information about the table column and the parameter. This function returns an integer value. It returns 1 for true, 0 for false, NULL for incorrect argument value and -1 for xml or large value types for precision property.

Function Syntax

COLUMNPROPERTY ( id , column , property )

ID – This is an identification number represents the table object id and procedure id.

Column – This is the column name or parameter name.

Property – This is the predefined name for the property information.

Available column property name

pic1Example

Retrieve column information using ColumnProperty() function

pic2

Catalog views that are used to get column and parameter information.

SELECT * FROM sys.procedures  — Stored procedures
SELECT * FROM sys.parameters — Parameters

SELECT * FROM sys.objects  — Database Objects
SELECT * FROM sys.columns — Column names

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: