SQL Server Table Column Types
What are the different Data Types we are using for Database (DB) design and development in SQL Server and Oracle? What is their importance for our database to be clear and easy to handle and maintain?If we are designing the database for any system of the backend and frontend processes for our companies and organization. Then we have to consider tables and columns and their Data Type to suite the columns and table structure. We create these columns and tables to store the data or records to get more information. But this is only possible for us to store the information regarding the different type of information like First Name, Last Name, Middle Name, Date Of Birth (D.B.O.), SSN), License Number and Passport, Account Number, Purchase Date, Sale Date, Amount, Fee, Salary, Yes, No etc.
It is really important for us to have more information about the Data Types used in the database to store the information in the better way and more compatibility with the records and data types.
We should know about which data types is useful for which type of records. So let have small overview about the different type of the data types.
1) Character Strings (Varchar, Char and Text):- These data types are used to store the information like First Name, Last Name and Middle Name, Company’s Name, Business Name and Process Name etc. Varchar is useful to store the numbers and characters and combination of the two. Char is only useful for the characters like Short Name and Nick Name and etc. These are also known as Non-Unicode.
2) Unicode Strings (nVarchar, nChar and Ntext):- These data types are used to store the records in all the different languages of world. Non-Unicode only support to have the one language in the database.
3) Bit:- It is used as flag to say that if it is Yes or No and also Active or inactive. This is used in the database for having the flag to read by the query by the user.
4) Date and Time (Date, DateTime, DateTime2, Time, DatetimeOffset and SmallDateTime):- it is useful for us to store the Start and End, Date of birth, Purchase and Sale Dates, Opening and Close Account Dates with the time stem with it and SmallDate is useful to store the Dates only. SmallDateTime is basically supports the only date stamp but DateTime datatype stores the dates along with the time stamp. It depends on the requirement for which data type is useful for us for which problem to solve.
5) Approximate Numerics (Float and Real):- These data types are used in the SQL server for storing the float and the real values in the database.
6) Exact Numerics ( tinyint, smallint, int, bigint, bit, money, smallmoney and numeric):- These data types are used to store the numeric values like ID’s H.no. and EmployeeID and DepartmentNo. If we ar going to store the amount, Salary, Funding Amount, Money Received is stored in the Money and smallmoney data type. The data types like tinyint, smallint, int, bigint are used to store the records numbers and it could be the primary key.
If we are knowing these data types and their meaning and their use, then we are good to design a well defined and well handled database for our companies and organizations. But if we are not aware about these data types, then we are just palying hide and seek with the database, that could lead to a database disaster.
I will be explain about these data types in another articles. This is also a basic rule for strat doing the Data Modelling in the database.
Thanks,
Sandeep Rajmail


Leave a Reply