WiseOwl Training - Established 1992 Wise Owl Training

Established May 1992
30 years in business
Wise Owl Training
30 years in business
See 519 reviews for our classroom and online training
T-SQL data types - int, float, decimal, varchar, etc.
Part one of a six-part series of blogs

Whether you're creating tables in SQL Server, using SQL variables or passing parameters to stored procedures, you'll need to understand what the possible data types that you can use are.

  1. Data Types in T-SQL for SQL Server (this blog)
  2. Text Data Types in T-SQL
  3. Number Data Types in T-SQL
  4. Date and Time Data Types in SQL
  5. Logical, Boolean, Yes/No or Bit Data Types in SQL
  6. Converting between Data Types

This blog is part of our SQL tutorial.  Don't forget that Wise Owl are mainly a provider of SQL (and other) training courses.

Posted by Andy Brown on 05 October 2012

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Data Types in T-SQL for SQL Server

Whether you're creating tables, passing data to stored procedures or working with variables, you'll need to know what sorts of data SQL Server can work with.

You'll also need to know how to convert between data types, and this is covered at the end of this blog.

The Mickey Mouse Guide to SQL Data Types

If you want a quick reference, you can't go far wrong with choosing between these data types (the rest of this blogs gives the full Monty on what's going on):

What you're storing Use Notes
Any string of text varchar(MAX) The string of text does have a theoretical maximum limit of 2,147,483,647 characters.  That's a LOT of text!
Any whole number int Again, this has a theoretical maximum value of 2,147,483,647.  This is a large number.
Any other number float This can hold virtuallly any number you can conceive of, from the tiniest fraction to the number of atoms in the Universe.
Any date date Holds any date between 1st January in 1AD to 31st December 9999!
Any logical (yes/no) value bit A bit is either on or off (0 corresponds to False, and 1 to True).
A calculation N/A Computed columns are covered in this separate blog.

For those who want to know more than this, the rest of this blog gives a fuller picture (it's still not the whole story though).

This blog has 0 threads Add post