Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
SQL Tutorial
Introduction to SQL
RDBMS VS DBMS
SQL Syntax
SQL Data Type
 


  

 
SQL Data Type
Question Posted on 07 Nov 2019

Home >> Tutorial >> SQL >> SQL Data Type


SQL Data Type
In SQL data type defines what kind of value a column can contain in each and every tables or in another defination we can say data types are bascially used to represent the nature of data that we stored or saved in database table. Let suppose we need store some string values in any column then we declare that as string.

Below are the 3 different classification of data types.
(1)String Data Types
(2)Numeric Data Types
(3)Date and time Data types

List of different Data Types in SQL Server

SQL Server String Data Type
(1)CHAR(Size):-It have fixed width character string data type and this fixed width is defined in place of Size. And size is upto 8000 Characters.
(2)varchar(Size):-It is also a character string data types with fixed length which is defined in Size. And maximum size is 8000 characters.
(3)varchar(max):-It is also same as above and is character string data types but the maximum size is approx 107374124 characters.
(4)text:-Same as above is character string data types and about size is up to 2GB of text data.
(5)nchar(Size):-It is used to store fixed width unicode string data type but size is upto 4000 charcters.
(6)nvarchar:-Its a variable width Unicode string data type but have maximum 4000 characters.
(7)ntext:-Its a variable width Unicode string data type and size is up to 2GB of text data.
(8)binary(n):-Its a fixed width binary string data types and size is upto 8000 bytes.
(9)varbinary:-Its a variable width binary string data type and size is upto 8000 bytes.
(10)image:-Its a variable width binary string data type and size is upto 2GB.

SQL Server Numeric Data Type
(11)bit:-Its a interger which can 0,1 or null.
(12)tinyint:-Its have whole numbers which is upto 0 to 255.
(13)Smallint:-Its used to store whole number and range is from -32768 to 32767.
(14)Int:-Its also used for whole number and range is in between -2,147,483,648 and 2,147,483,647.
(15)Bigint:-Its also used fro whole number and rane is in between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807.
(16)real:-Its a floating precision number data from -3.40E+38 to 3.40E+38.
(17)money:-Its used to specify monetary data from -922,337,233,685,477.5808 to 922,337,203,685,477.5807.

SQL Server Date and Time Data Type
(18)datetime:-Its used to specify date and time combination and range is from January 1, 1753 to December 31, 9999 and cotains accuracy of 3.33 milliseconds.
(19)datetime2:-Same as above but range starts from january 1, 0001 to December 31, 9999 and accuracy is upto 100 nanoseconds.
(20)date:-Its used to store only data and range is from January 1, 0001 to December 31, 9999.
(21)time:-Its used to store only time with accuracy of 100 nanoseconds.
(22)timestamp:-Its store a unique number when a new row created or modified. The time stamp value is based upon an internal clock and does not correspond to real time. Each table may contain only one-time stamp variable.

SQL Server Other Data Type
(23)Sql_variant:-Its used for data types except for text, timestamp, and ntext. It stores up to 8000 bytes of data.
(24)XML:-It stores XML data and maximum limit is 2GB.
(25)cursor:-Its store a reference to a cursor used for database operations.
(26)table:-Its store result set for later processing.
(27)uniqueidentifier:-It stores GUID (Globally unique identifier).





Other Important Questions
SQL Tutorial
Introduction to SQL
RDBMS VS DBMS
SQL Syntax
SQL Data Type







 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |