What is the difference between char, nchar, varchar, and nvarchar in SQL Server?





  • nchar and nvarchar can store Unicode characters.
  • char and varchar cannot store Unicode characters (store ASCII characters)
  • char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don't use up all that space.
  • varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar
  • Char/varchar = 8 bit length of each character
  • NChar/nvarchar = 16 bit length of each character

Comments

Popular posts from this blog