How the processing of char and varchar is different. Which one data type you will prefer and why?
C# Curator
Select an image from your device to upload
Main different between char and varchar is memory. See this example:
It is the structure of a table "emp"
empcode1 char(5),
empcode2 varchar(5)
So if i have inserted value of 4 characters in every column link "s001" then column "empcode1" will occupy 5 byts in memory but column "empcode2"
will occupy only 4 byts in memory. varchar utilize memory according number of characters but char will utilize memory according to its size.
Varchar is variable length and char is fixed length.
We should use char when size of column data is fixed.
We should use varchar when size of column data is not fixed.