DIFFERENCE BETWEEN CHAR AND VARCHAR DATA TYPE IN SQL SERVER 2005

Similarities & Differences.

1.Both are non – unicode character data type.

2.Both can store maximum of 8000 characters.

3.Char data type is fixed length while a varchar data type is variable length.

4.If the number of characters entered in a char data type column is
less than the declared column length , spaces are appened to it to fill
up the whole length.

5.The storage size of char data type is n bytes while for varchar data type it is actual length in bytes of the data entered.

6.One should use char data type when the data values in a column are expected to be consistently close to the same size.

7.One should use varchar data type when the data values in a column are expected to vary considerably in size.

Pawan Kumar
Pawankkmr@hotmail.com

Advertisements