Gaurav Malviya
What is difference between CHAR and VARCHAR2? What is the maximum SIZE allowed for each type?
By Gaurav Malviya in SQL Server on Jan 14 2014
  • Manju lata Yadav
    Jul, 2014 1

    char [ ( n ) ]Fixed-length, non-Unicode string data. n defines the string length and must be a value from 1 through 8,000. The storage size is n bytes. The ISO synonym for char is character. varchar [ ( n | max ) ]Variable-length, non-Unicode string data. n defines the string length and can be a value from 1 through 8,000. max indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage size is the actual length of the data entered 2 bytes. The ISO synonyms for varchar are char varying or character varying.Use char when the sizes of the column data entries are consistent.Use varchar when the sizes of the column data entries vary considerably.Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.

    • 0
  • Gaurav Malviya
    Jan, 2014 14

    CHAR pads blank spaces to the maximum length. 
    VARCHAR2 does not pad blank spaces. 
    For CHAR the maximum length is 255 and 2000 for VARCHAR2.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS