welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Sunday, May 29, 2016

Difference between non unicode and unicode in sql server

(char, varchar, text)(nchar, nvarchar, ntext)
Stores data in fixed or variable lengthSame as non-Unicode
char: data is padded with blanks to fill the field size. For example, if a char(10) field contains 5 characters the system will pad it with 5 blanksnchar: same as char
varchar: stores actual value and does not pad with blanksnvarchar: same as varchar
requires 1 byte of storagerequires 2 bytes of storage
char and varchar: can store up to 8000 charactersnchar and nvarchar: can store up to 4000 characters
Best suited for US English: "One problem with data types that use 1 byte to encode each character is that the data type can only represent 256 different characters. This forces multiple encoding specifications (or code pages) for different alphabets such as European alphabets, which are relatively small. It is also impossible to handle systems such as the Japanese Kanji or Korean Hangul alphabets that have thousands of characters."1Best suited for systems that need to support at least one foreign language: "The Unicode specification defines a single encoding scheme for most characters widely used in businesses around the world. All computers consistently translate the bit patterns in Unicode data into characters using the single Unicode specification. This ensures that the same bit pattern is always converted to the same character on all computers. Data can be freely transferred from one database or computer to another without concern that the receiving system will translate the bit patterns into characters incorrectly.


Post a Comment