SQL SERVER – Data types

Data types in SQL Server

In relational database, we store data in tabular form where data is divided into columns. Each column has a name and a data type which shows what type of data is going to store in that column. Below are the data types which are mostly used in SQL server.CHARACTER(n)    Character string of fixed length n

VARCHAR(n)        Character string of variable length with maximum length n

VARCHAR(MAX)   Character string of variable length with maximum length can exceed 8000 byes

NCHAR(n)            Fixed-length Unicode string data where n defines the string length and must be a value from 1 through 4,000

NVARCHAR(n)     Variable length Unicode string data where n defines the string length and must be a value from 1 through 4,000

NVARCHAR(MAX) Variable length Unicode string data where MAX indicates that the maximum storage size is 2^31-1 bytes (2 GB)

BINARY(n)           Binary string of fixed length n

BOOLEAN             It stores TRUE or FALSE values

VARBINARY(n)    Binary string of variable length with maximum length n

NTEXT                  Variable-length Unicode data with a maximum string length of 2^30 – 1 (1,073,741,823) bytes

TEXT                    Variable-length non-Unicode data in the code page of the server and with a maximum string length of 2^31-1                                       (2,147,483,647)

IMAGE                 Variable-length binary data from 0 through 2^31-1                                          (2,147,483,647) bytes.

INTEGER Or Int   A 32-bit signed integer value having range of INTEGER is                                -2147483648 to 2147483647

SMALLINT           A 16-bit signed integer value having range of SMALLINT is                              -32768 to 32767.

BIGINT               A 64-bit signed integer value having range of BIGINT is                                   -9223372036854775808 to 9223372036854775807

DECIMAL(p,s)    Exact numerical, precision p, scale s. For Example,                                         Decimal(5,3) means 22.212

NUMERIC(p,s)   Exact numerical, precision p, scale s. (Same as DECIMAL)

REAL                  Approximate numerical, mantissa precision 7

FLOAT                Approximate numerical, mantissa precision 16

DOUBLE             Approximate numerical, mantissa precision 16

DATE                  It stores year/month/day values

TIME                  It stores hour/minute/second values

TIMESTAMP       It stores year/month/day/hour/minute/second values

XML                    It stores XML data

About vivekjohari

Database Consultant with more than 11.5 years of experience in database designing & programming and DBA related activities.  Had good experience on different databases like SQL Server, MySQL & Oracle, Azure SQL &  Big Data.
This entry was posted in SQL Basic, SQL Data Types, SQL Server and tagged . Bookmark the permalink.

32 Responses to SQL SERVER – Data types

  1. Pingback: กำถั่ว

  2. Pingback: 바카라사이트

  3. Pingback: game changer

  4. Pingback: Creative Agency Graphiste à Montreux

  5. Pingback: How to watch Rugby World Cup 2019 live stream online instantly

  6. Pingback: didi promo code

  7. Pingback: แทงบอลออนไลน์

  8. Pingback: click here to visit Bhojpuri film for free

  9. Pingback: bitcoin

  10. Pingback: Gangnam clinic

  11. Pingback: https://drywallrepaircontractors.info/usa/drywall-repair/mt

  12. Pingback: http://amhurt.pl/nadzieja-2188.php

  13. Pingback: tiketqq

  14. Pingback: ฝากถอนโอนไว

  15. Pingback: شركات التنظيف بالرياض

  16. Pingback: บริษัท ออล ครีเอตี้ แลนด์ จำกัด

  17. Pingback: https://biznesblog.biz.pl/co-zrobic-gdy-klient-nie-placi-faktur/

  18. Pingback: dang ky bong88

  19. Pingback: nha cai w88

  20. Pingback: Dream Market

  21. Pingback: w88 play

  22. Pingback: market survey for new business

  23. Pingback: cá độ online

  24. Pingback: pokermas99

  25. Pingback: www.nuguru.info

  26. Pingback: artikel kesehatan

  27. Pingback: granice

  28. Pingback: www.1lapakqq.site

  29. Pingback: ltc qr code generator

  30. Pingback: www.rajaqqtop.com

  31. Pingback: qiuqiu99

  32. Pingback: Walmart

Leave a Reply