SQL Data Types – Overview of Data Types in TSQL

Last modified date:

All columns, variables or terms in SQL Server have their defined data types. These data types define of what type are the values which can be contained in given column or other logical object. Every time you try to create a table , variable or term, a definition defining sql data types is required.

Wrong data type selection in objects can later result in big troubles. Typical example is choice of data type for amount of sales for example. We wrongly select too short numeral format since we expect the company to never have higher sales than X USD. But we will be surprised when we get this Error “Arithmetic overflow error converting numeric to data type numeric” in a few years time :).

SQL Data Type error

Except for its own data types in t-sql that can be defined in SQL Server using .NET framework, the SQL Server also provides default data types. This is the topic of the following overview.

SQL Data types – Categories

System data types are in SQL Server into 7 logical categories:

  1. A) Exact Numerics
  2. BIGINT
  3. BIT
  4. DECIMAL
  5. INT
  6. MONEY
  7. NUMERIC
  8. SMALLINT
  9. SMALLMONEY
  10. TINYINT

More details in this article

  1. B) Approximate Numerics
  2. FLOAT

2.REAL

More details in this article

  1. C) Date and Time
  2. DATE
  3. DATETIME
  4. DATETIME2
  5. DATETIMEOFFSET
  6. SMALLDATETIME
  7. TIME

More details in this article

  1. D) Character strings + UNICODE
  2. CHAR + NCHAR
  3. VARCHAR + NVARCHAR
  4. TEXT + NTEXT
  5. E) Binary strings
  6. BINARY
  7. VARBINARY
  8. IMAGE
  9. F) Other data types
  10. CURSOR
  11. TIMESTAMP
  12. HIERARCHYID
  13. UNIQUEIDENTIFIER
  14. SQL_VARIANT
  15. XML
  16. TABLE

I will take a look at every category in a special article

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Category: SQL Tutorials Tags:

About Ing. Jan Zedníček - BI Developer, Finance controller

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.