Kamis, 29 Juli 2021

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

One of the frequently asked SQL questions in any programming interview 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 space? Is it better to use a CHAR variable instead of VARCHAR(2) and why? These are some of the really interesting questions and more meaningful than classical SQL questions like the difference between char vs varchar data type questions.

Lorem ipsum is simply dummy text of the printing and typesetting industry.

Comments


EmoticonEmoticon