• Home
  • DBA Scripts
    • Oracle Scripts
    • SQL Server Scripts
  • Knowledge Base
    • Oracle Database
    • MS SQL Server
    • MongoDB
    • MariaDB
  • Troubleshoot
    • Oracle Database Issues
    • SQL Server Issues
  • Interview Questions
    • AWS Interview Questions
    • Oracle DBA Interview Questions
    • SQL Server Interview Questions
  • Courses
    • Oracle Database
    • Oracle DBA L1
    • Oracle DBA L2
    • Oracle DBA L3
  • Home
  • DBA Scripts
    • Oracle Scripts
    • SQL Server Scripts
  • Knowledge Base
    • Oracle Database
    • MS SQL Server
    • MongoDB
    • MariaDB
  • Troubleshoot
    • Oracle Database Issues
    • SQL Server Issues
  • Interview Questions
    • AWS Interview Questions
    • Oracle DBA Interview Questions
    • SQL Server Interview Questions
  • Courses
    • Oracle Database
    • Oracle DBA L1
    • Oracle DBA L2
    • Oracle DBA L3
home/Knowledge Base/MS SQL Server/SQL Server T-SQL Data Types
Popular Search:Oracle, SQL Server, MongoDB

SQL Server T-SQL Data Types

57 views 0 September 7, 2019 admin

 
Data Category Data Type Size Value Range
 

 

 

 

 

 

Exact Numaric

Bit 1 1,0 or Null
Tinyint 1 0 to 255
smallint 2 -2^15 (-32,768) to 2^15-1 (32,767)
Int 4 -2^31 (-2,147,483,648) to 2^31-1

(2,147,483,647)

Bigint 8 -2^63 (-9,223,372,036,854,775,808) to 2^63-1

(9,223,372,036,854,775,807)

smallmoney 4 -214,748,3648 to 214,748,3647
Money 8 -922,337,203,685,477,5808 to

922,337,203,685,477,5807

Numaric[(p[,s])] 5-17  
Decimal[(p[,s])] 5-17  
 

Approximate Numeric

Float 4-8 -1.79E+308 to -2.23E-308, 0 and 2.23E-308 to

1.79E+308

Real/float(24) 4 -3.40E +38 to -1.18E-38,0 and 1.18E-38 to

3.40E+38

 

 

Character Strings

char[(N)] N  
varchar[(N or max)] N or 2^31-1 N = 1 to 8000 non-Unicode characters bytes

Max=2^31-1 bytes (2 GB) non-Unicode

Text 2^31-1 1 t0 2^31-1 (2,147,483,647) non-Unicode

characters bytes

 

unicode character strings

nchar[(N)] N N = 1 to 4000 UNICODE UCS-2 bytes
nvarchar[(N|max)] N or 2^31-1 N = 1 to 4000 UNICODE UCS-2 bytes

1 to 2^31-1 (2,147,483,647) UNICODE

Ntext 2^31-1 Maximam size 2^30-1 (1,073,741,823) bytes
 

Binary strings

binary[(N)] N N = 1 to 8000 bytes
varbinary[(N|max)] N or 2^31-1 N = 1 to 8000 bytes Max = 0 to 2^31-1 bytes
Image 2^31-1 0 to 2^31-1 (2,147,483,647) bytes
 

 

 

 

 

 

other data types

Uniqueidentifier 16 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx(hex

decimal)

Timestamp 8 binary(8) or varbinary(8)
rowversion 8 binary(8) or varbinary(8)
xml 2^31-1 xml([CONTENT|

DOCUMENT]xml_scheme_collection)

sql_variant 8016 data type that stores values of various SQL

Server -supported data types

Hierarchyid 892 6*logAn bits where n is child node
Cursor    
Table    
Sysname 256  

 

 

 

 

 

 

 

Date & Time

Date 3 0001-01-01 through 9999-12-31
time[(fractional

second precision)]

3 to 5 00:00:00.0000000 through 23:59:59.9999999
Smalldatetime 4 Date: 1900-01-01 through 2079-06-06

Time: 00:00:00 through 23:59:59

Datetime 8 Date: January 1,1753, through December

31,9999                               Time: 00:00:00 through

datetime 2 [(

fractional secounds

6 to 8 Date: 0001-01-01 through 9999-12-31

Time: 00:00:00 through

datetimeoffset [(fractional

secounds

 

8 to 10

Date: 0001-01-01 through 9999-12-31

Time: 00:00:00 through

23:59:59.9999999

Spatial Geography 2^31-1  
Geometry 2^31-1  

 

Was this helpful?

Yes  No
Related Articles
  • MS SQL Server Notes
  • Important Counters (perfmon.exe)
  • Restoring Backup via Scripts
  • Restore Backup in SQL Server
  • SQL Server JOBS
  • Backup using T-SQL
Leave A Comment Cancel reply

MS SQL Server
  • SQL Server T-SQL Data Types
  • MS SQL Server Notes
  • Important Counters (perfmon.exe)
  • Restoring Backup via Scripts
  • Restore Backup in SQL Server
  • SQL Server JOBS
View All 20  
Popular Articles
  • Upgrade Oracle Database from 11.2.0.3 to 12.1.0.2
  • Upgrading MariaDB on Windows
  • Oracle DBA Basic Interview Questions Part A
  • Purging Oracle Sysaux Tablespace
  • Client – Server Architecture
KB Categories
  • Oracle Database
    • Oracle RAC
    • Oracle ASM
    • Oracle GoldenGate
    • Oracle Tuning
    • Oracle 11g Database
    • Oracle Database Upgrade
    • Oracle 12c Database
    • ALL KB Oracle
    • Oracle 18c Database
    • Oracle Standby Database
  • MongoDB
  • MS SQL Server
  • MySQL
  • Interview Questions
    • AWS Interview Questions
    • Oracle DBA Interview Questions
    • SQL Server Interview Questions
  • MariaDB
Database Organization

Database Organization (DB ORG) is knowledge base for DBA to learn and execute the fundamental of different databases under one website. DB ORG is a non-profit initiative. ORACLE, MS SQL Server, MongoDB, MariaDB, Couchbase

Join Our Community
  • KnowledgeBase
  • Documentation
  • Troubleshoot
  • FAQ
Information Links
  • About DBOrg
  • Licenses
  • Terms
  • Privacy Policy
Contact Us
    DB ORG - Database Administration,
    Knowledge Base for DBA
    Mail: support@databaseorg.com
    WhatsApp: (+91) 9306440957
    Monday to Friday: EST - 11:30 AM to 06:30 PM (IST - 9:00 PM to 4:00 AM)
  • © 2023 Database Organization - DB ORG. All Rights Reserved.

Popular Search:Oracle, SQL Server, MongoDB

WhatsApp DB Org