I want to know how SQL Server handles varchar dynamic length and storage internally.
Is there beneficial to use Varchar if i know that i have fixed length of character is coming in column ?
I know difference between CHAR and VARCHAR, but what’s best way to use in big database for database design CHAR or VARCHAR ?
CHAR allocates its size in row, VARCHAR stores real size of string (2 bytes) and then the real string, so overhead of varchar is +2 bytes, and overhead of CHAR is – its size minus real string length. If in varchar stored NULL value – its size in db is Zero.
See Anatomy of the Record