Friday, July 18, 2014

Data Types in SQL Server.

In Database, Each Column,Variable,Expression and Parameter has one related data type. A data type is an attribute that specifies the type of data that a object can hold.

For better understanding Data Types have been divided into multiple groups, If you are new to SQL Server then you don't need to search on Google to find what are the all data types supported by SQL Server.You can find it in your own SQL Server.

You can find all SQL Server supported data types using below two methods.

Method 1- Please follow the below path in your SQL Server to get list of all data types supported by your SQL Server.

If you can't remember all data types range don't worry your SQL Server can tell you each data type range.Just mouse over on any data type a pop up will come it will tell you the data type range.i.e I want to check data range of Int data type, no worry just do mouse over on Int data type.


Method 2 - If you don't remember data type size don't worry you don't need to Google it, There is another way to find all data types with their properties i.e data type name,maximum size in bytes,precision, sclae etc in the SQL Server. In your database go to the Views folder, navigate to system views, I have attached image below which shows the path to system view.


Search for Sys.Types view in System Views. Below I have attached the image.


You can query against this view to find all data types details using the below query.

Select * from sys.types
or
Select * from systypes


If you liked the article hit the Facebook like button.

Keep Learning! 

No comments: