BISQL # 41 : Difference Between Char And Varchar
Hi Friends,
One of my dearest friends is asking for Difference Between Char And Varchar. I feel its very simple but after having long conversation with her I realize we should have differentiation article based on same.
Sites supporting multiple languages should consider using the Unicode nchar or nvarchar data types to minimize character conversion issues. If you use char or varchar:
- Use char when the data values in a column are expected to be consistently close to the same size.
- Use varchar when the data values in a column are expected to vary considerably in size.
If SET ANSI_PADDING is OFF when CREATE TABLE or ALTER TABLE is executed, a char column defined as NULL is handled as varchar.
When the collation code page uses double-byte characters, the storage size is still n bytes. Depending on the character string, the storage size of n bytes may be less than n characters.
What’s the difference between CHAR and VARCHAR?
The short answer is: VARCHAR is variable length, while CHAR is fixed length.
In the following difference you may find some point keep repeated but I think I don’t want reader to get confused when the refer to other blog and have whole bunch of differentiation in single table
Please click on image if its look in smaller font
When should We use CHAR instead of VARCHAR?
The short answer is: Almost never.
Hope this helps !!!
For more interesting information on SQL we can also look into similar topics such as
· BISQL # 42 : How to find count of all the records in all the table
· BISQL # 43 : Introduction to DAC – Data-Tier Application {DAC Part – I}
· BISQL # 44 : DAC-Database Project Overview {DAC Part – II}
· BISQL # 45 : How to Rename .MDF File and .LDF file ? (i.e – .mdf , .ldf)
· BISQL # 46 : Information of SQL Server Database Services and Startup account
Hope you will like this post on Difference between Char & Varchar.
If you really like reading my blog and understood at least few thing then please don’t forget to subscribe my blog.
If you want daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog : Link Resource Website
For More information related to BI World visit my Mentalist Blog
Link Resource Blog >> Daily Interesting links
SQL Server Mentalist >> SQL Learning Blog
Business Intelligence Mentalist >> BI World
Connect With me on
Copyright © 2011 – 2012 Vishal Pawar
Great Article.
Thank for the comment Asuncion !! Really Appricated u r valuable feedback !!
Thank you.