Blog
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
    Single Page App
    Bootstrap
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
 

Home >> Database >> Difference between char, varchar and nvarchar in sql server
Difference between char, varchar and nvarchar in sql server

char, varchar and nvarchar are SQL Server data type that used for allocated memory in storage device. But there is little difference between them which described below:
Views: 2128     Comments: 0
by AVADHESH PATEL on 4/5/2013

Difference between char, varchar and nvarchar in sql server

char, varchar and nvarchar are SQL Server data type that used for allocated memory in storage device. But there is little difference between them which described below:

char

It stores fixed length of character. For example if you declare char (10) then it allocates memory for 10 characters. If you store 5 character words then it stores it in 5 characters memory location and other 5 character's memory location will be wasted. Per character, it takes 1 Byte memory.

varchar

varchar is flexible data type means it allocates memory as per data stored into this. If you specify varchar(10) at the time of declaration then it allocates 0 memory location at the starting if you specify, it can be null. When you store 5 characters word it will allocate memory for 5 characters and store into that. So there will be no memory loss. It stores only non-unicode characters means for English language only. Per character, it takes 1 Bytes memory.

nvarchar

nvarchar means unicode variable characters. When you want to store international character in database then used nvarhcar. It used really because it increases database size twice than varchar datatype because it takes 2 Bytes memory for each character.

Title :  
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
       
 
Report Abuse Form
Reason:    
 
Latest ArticleRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest Blogs by AVADHESH PATELRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 3696
  
Copyright © 2009 - 2014MindStick. All Rights Reserved.