SQL DataTypes

Latest Posts

  • ·

    SQL DECIMAL Data Type

    Use the SQL Server DECIMAL data type to define columns that have fixed precision and scale.  Unlike FLOAT, DECIMAL data type has fixed decimal places.  Use DECIMAL data type and NUMERIC data type keywords interchangeably to define the type.  DECIMAL(precision, scale)  When defining, the DECIMAL data type provides both precision and scale.  The precision defines the total number of decimal digits to store…

  • ·

    SQL Server FLOAT Data Type

    Use the SQL Server FLOAT data type to define columns, variables, and parameters storing floating-point numbers.  By floating point, we mean, numbers that have no fixed decimal place.  Consider using SQL FLOAT when working with scientific values.  Unlike DECIMAL, the FLOAT type handles a wide range of numbers:  Here is the range expressed in scientific notation:  Sign  Max Value  Minimum Value  Negative  – 1.79E+308  -2.23E-308  Positive  1.79E+308 …

  • ·

    VARCHAR Data Type

    Use the SQL Server VARCHAR data type to define columns, variables, and parameters variable length characters.  VARCHAR types are variable in length.  They do not take up more memory than the characters stored.  This differs from the CHAR type, which always occupies the full amount defined.  The VARCHAR type stores up to 8000 characters with each character taking one byte. …

  • ·

    SQL INT Data Type

    Use the SQL Server INT data type to define columns, variables, and parameters storing whole numbers.  The INT data type stores a number in the range -2,147,483,648 to 2,147,483,647.  If you need to store a larger integer value, consider using BIGINT.  In addition to being used for numbers, INT is also used to define primary and foreign keys.  Use it to create…

  • ·

    SQL DATETIME Data Type

    Use the SQL Server DATETIME data type to define columns, variables, and parameters storing a date with the time of day.  The DATETIME data type stores both the date and time.  The allowed dates span from January 1, 1753 to December 31, 9999.  The time component ranges from 00:00:00 through 23:59:59.997.  Here is an example of a valid DATETIME value:  2017-11-23 11:30:34  Which represents November, 23rd 2017…

  • ·

    NVARCHAR Data Type

    Use the SQL Server NVARCHAR data type to define columns, variables, and parameters variable length characters.  NVARCHAR types are variable in length.  They take up more memory than the characters stored.  This differs from the CHAR type, which always occupies the full amount defined.  They store up to 4000 characters with each character taking two bytes and are is well suited for storing extended character…

  • ·

    SQL Data Types

    In SQL the columns of a table are defined to store a specific kind of value such as numbers, dates, or text; these are called data types.  With over thirty types of SQL server data types to choose from, data types can seem intimidating, but in reality, there are just a few commonly used in…

  • Common Data Types used in SQL Server

    ·

    Common Data Types used in SQL Server

    In this video we’ll walk you though the common data types used in SQL Server; you’ll see examples of each type’s values, and how to define them. Once you’ve gone through this article, I would recommend watching our next Essential SQL Minute to continue learn more about SQL Server! Once you have watched the video…

  • Uncommon SQL Server Data Types

    ·

    Uncommon SQL Server Data Types

    In this article we’re going to go over a uncommon SQL server data types.  These are those you won’t use every day, but you’ll want to know if you take the 70-461 exam. Even if you don’t plan on taking the 70-461, learning these data types is fun, especially the spatial datatype (I had no idea…

  • What is a Database NULL Value?
    ,

    ·

    What is a Database NULL Value?

    What is a Null Value? In databases a common issue is what value or placeholder do you use to represent a missing values.   In SQL, this is solved with null.  It is used to signify missing or unknown values.  The keyword NULL is used to indicate these values.  NULL really isn’t a specific value as much as it…