Tuesday, April 7, 2020

SQL Data Types | Data Types In SQL Server


SQL Data Types :



Definition of Data Type :


SQL data types defines the type of values, that can be stored in a database or table.

Or

Data types specifies the type of any object.
Or

Data type is an attribute that specifies what type of data can be stored in a column, parameter, or variable.


For example, 

If we want to store on numeric value to Customer_Id, then we can define Customer_Id data type as int.

SQL Server has following data types :

Numeric

Numeric data can be stored. It has two sub type (1) Exact and (2) Approximate.

Date/Time

In this data type we can insert date & time.

Format of date : YYYY-MM-DD
Format of time : hh:mm:ss

Binary

Binary data stores strings of bits. The data consist of hexadecimal numbers. Data must have the same fixed lenght up to 8 KB.

Example :

The hexadecimal number of 245 is F5.

String / Char:

Using with this data type we can insert text/ character in our sql database.

Varbinary

Data can vary in the number of hexadecimal digits. It contains up to 8KB.

Notes :

In SQL Server, you can create user-defined data types, that are based on the system supplied data types.


Latest
Next Post

post written by:

0 Comments: