Skip to main content

Posts

Showing posts with the label SQL tables data types

Difference in CHAR and VARCHAR2 Data type in SQL

Char is fixed length Datatype. and Varchar is variable length datatype. Suppose you have 2 columns, 1 with Char(40) another with Varchar2(40)  and both columns has values with only 10 characters in a record that time SQL server still occupy 40 character space in system for 1st column and 10 character space in system for 2nd column. Simple pick char if length is going to remain same otherwise pick varchar as a speed both have its advantage . Choosing data type cannot be done by yes or no you have to choose data type as per your requirement both are good and bad.