How many characters is allowed on VARCHAR(n) columns in SQL Server? How much memory VARCHAR variable takes in disk?

One of the frequently ask SQL questions in any programming interviews is what is the difference between VARCHAR and CHAR data type in SQL? particularly when your project is using Microsoft SQL Server. You might have seen this couple of times, but given its popularity, nowadays people are asking this question differently e.g. they will ask you how much space a column of VARCHAR(2) data type will take? How many characters can it take? How do you minimize the space? Is it better to use a CHAR variable instead of VARCHAR(2) and why? These are some of the really interesting question and more meaningful than classical SQL questions like the difference between char vs varchar data type question.
Read more �

Posting Komentar

0 Komentar