• 13. 1. 2020
  • Ing. Jan Zedníček - Data & Finance
  • 0

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

Rate this post

Ing. Jan Zedníček - Data & Finance

My name is Jan Zedníček and I work as a freelancer. I have been working as a freelancer for many companies for more than 10 years.
I used to work as a financial controller, analyst and manager at many different companies in field of banking and manufacturing. 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 and to put them forward to anyone.

Leave a Reply

Your email address will not be published. Required fields are marked *