C# Curator
How the processing of char and varchar is different. Which one data type you will prefer and why?
By C# Curator in SQL Server on May 07 2010
  • yakoob pasha
    Jul, 2010 29

    Hi,

    Both the datatypes have their own significance.
    Memory wise, varchar is the better one,
    but for performance, char is suggestible ..
    so it purely depends on your requirement.
    But one thing is that varchar uses Unicode standard
    where as char doesnt..
    Thank You 

    • 0
  • Ramchandra Desai
    Jun, 2010 15

    "varChar" can adjust according to the requirement but 'char" cannot adjust that is why I will prefer "varChar" to save the memory space.

    • 0
  • manish banga
    May, 2010 24

    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.

    • 0
  • Lakhwinder Singh
    May, 2010 19

    char take only character values like a,b,c etc . but varchar can take any character,special char,numeric also.

    so i will prefer varchar datatype because u can take any type of data by using varchar data type.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS