Wednesday, 6 October 2010

Difference between char and varchar data types

The CHAR datatype uses a fixed length, where as the VARCHAR datatype can be variable in length up to the maximum value specified for the length. 
If you insert "Hello" into a CHAR(10) field, the column would actually contain "Hello " with 5 trailing spaces. 
The same value inserted in a VARCHAR(10) field would contain "Hello". 

char datatype is fixed length data type and it store maximum 255 characters while varchardatatype store up to 4000 character of variable length datatype


RB: Bila bos tanya, terpaksa la aku tanya en. google. Ni aku cedok dari website http://wiki.answers.com/Q/What_is_the_difference_between_char_and_varchar_data_types

0 comments:

Post a Comment