You must Sign In to post a response.
  • Category: SQL Server

    What is difference between Char,Varchar,NVarchar ?

    please suggest me on difference between Char,Varchar,NVarchar datatypes in sql server
  • #737799
    NVARCHAR - This data type will be used when you wanted to store unicode data. That is in the case you are saving data in English and non-English language. NVARCHAR will use almost double size as much space as varchar uses. So you may use VARCHAR if you are storing data only in English language.

    CHAR is same as VARCHAR except you have to provide the data size in advance and system allocate that much space irrespective of it's usage where is VARCHAR will use only the used space it won't allocate whatever size you declared in case of VARCHAR.

    Asheej T K

  • #737801
    Char and Vchar are similar for storing normal ANSI character, the CHAR has small size and varchar is having more capicity.

    nVarchar is used to hold the Unicode character as well.

    Hope this will be neough for your information, for more details please refer MSDN.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #737808
    CHAR :
    it is fixed length datatype of sql. As we said it ha fixed data space range value from 1 through 8,000. Storage size is n bytes.

    As name suggest, it is variable-length datatype. It is also same like CHAR datatype but the main difference is the Storage size of the VARCHAR is the actual length in bytes of the data entered.
    Nvarchar can store Unicode characters, it declears variable-length of characters which will only use up spaces for the characters you store. It will not reserve storage like char or nchar.
    nChar and nVarchar used more sapce than regular char and varchar so use them only if you really needed by you.
    Hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #737818
    Char datatype which is used to store fixed length of characters. For example we declared char(25) it will allocates memory for 25 characters. Varchar means variable characters and it is used to store non unicode characters. e declared varchar(25) it will allocates memory of 0 characters at the time of declaration .nvarchar datatype same as varchar datatype but only difference nvarchar is used to store Unicode characters .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.

  • #738731
    Char -Fixed Length Character data Maximum Storage 8000

    nchar - Fixed Length unicode Characted Maximum Storeage 4000

    Char- 8bit Length

    Nchar - 16bith Length

  • #739355
    Unicode characters can be stored by nchar and nvarchar.
    char and nchar are fixed-length while varchar and nvarchar are variable-length.
    char and varchar cannot store Unicode characters.

    Best regards,
    Prachi Kulkarni.

  • Sign In to post your comments