#DecodeITeS
SQL Server Data Types
SQL Server Data Types
Types of SQL Server Data Types
Categories of SQL Server Data Types
Exact numeric
Approximate numeric
Date and time
Character strings
Unicode character strings
Binary strings
Other data types
In SQL Server, Type of data hold by column in table, variable, or parameter is called Data Type. Data can be text, integer, date or sting, SQL Server covers all options with a variety of available data types.
E.g.:- In You collage Records,
Your Name is the Alphabet field.
Date of Birth is the Date field.
Marks Obtained is Numeric \ Integer filed.
Contact Number is Numeric \ Integer filed.
Fee is Money Filed.
Developers need to be very careful to select the appropriate data type for each need during database designing. Each data type has it’s lower & upper range with storage & memory requirement, correct data type helps DB engine for better data management as well as the boost in performance optimization and database management by Database Administrators.
Types of SQL Server Data Types
Default \ Built-in Data Types:- As the name implies, default or built-in data types comes with SQL Server installation. These data types are divided into 7 categories.
User-Defined \ Customized Data Types:- SQL Server gives you the flexibility to create customized data types based on existing default data types with additional checks. Customized data types are database level property and valid on the current database only. These are very useful for developers to define data type once and can use then across the database. We will discuss customized data types in the next lesson.
Categories of SQL Server Data Types
SQL Server supports multiple datatypes and those data types are divided into following categories:
Exact numeric: bit, tinyint, smallint, int, bigint, decimal, numeric, money and smallmoney
Approximate numeric: Read and float
Date and time: date, DateTime, datetime2, datetimeoffset, smalldatetime, time
Character strings: char, varchar, text
Unicode character strings: Nchar, Nvarchar, Ntext
Binary strings: Binary, image and varbinary
Other data types: Cursor, hierarchyid, sql_variant, table, rowversion, uniqueidentifier, XML, Spatial and geography