Two days before, One of my colleague who is a .Net Programmer named Preethy Kamath (an enthusiastic lady)came and asked me what is the difference between char and varchar. I explained her in detail about the difference and that is what I am going to explain here.
- Char
It is fixed length non-Unicode character data with a length from 1 to 8000 bytes.
- Varchar
It is variable length non-unicode character data with a length from 1 to 8000 bytes.The maximum storage size is 2^31-1 bytes.
From the columns varchardatalength and Chardatalength we came to understand that the varchar takes only 3 character length(since it is variablelength) and Char takes 50 charlength(since it is fixed length).
- Conclusion
Please be careful while choosing the data type during Database design .
I hope every one like this article,Heathly comments are welcomed.Thanks Preethi once again for this wonderful basic question.