SQL Server data types

WHAT IS THE DATA TYPE?

HOW TO USE MS SQL DATA TYPE

  • It is necessary to define in advance the type of data that a column or a variable can store. The definition of the data type also limits the user from entering any unexpected or invalid data.
  • You can effectively use memory by assigning the appropriate data type to a variable or column that will allocate only the necessary amount of system memory for the data in the corresponding column.
  • MS SQL offers a wide category of data types according to user needs. Like a date, binary images, etc.

WHY USE DATATYPES?

  • The “Name/Surname” will always be alphabetical.
  • Contact” will always be numeric.
  • From the above figure, you should specify “Name/Surname” as a symbol and “Contact” as an integer.
    Obviously, in any application, all fields have one or the other data type. For example, numerical, alphabetic, date, and much more.

THE DATA TYPE IS AVAILABLE IN MS SQL

  • Exact number
  • Approximate numerical
  • Date and time
  • Character strings
  • Unicode Character Strings
  • Binary rows
  • Other types of data

EXACT NUMBER

EXAMPLES:

  • Accuracy
  • S is the scale

APPROXIMATE NUMERICAL

DATE AND TIME

CHARACTER STRINGS

UNICODE CHARACTER STRINGS

BINARY STRING

INTERESTING FACTS!

SUMMARY:

  • Each column in a table is defined by its data type when creating the table.
  • There are six main categories and one more category. The other different ones have nine subcategories of available data types.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store