ttmind

Main Navigation

ttmind
  • jim-jams
  • Tech
  • Positive
Login

Login

Facebook Google

OR

Remember me Forgot password?

Don't have account? Signup here.

Sort by Categorys

.Net

PHP

Java

JavaScript

Database

Server

Client Side

Tools

Artificial Intelligence

Cloud

Hybrid Development

Event

Smart City

Education

Security

Scrum

Digital Marketing

APP Development

Business

Internet

Simulation

Art

Network

Microservices

Architecture

Technology

Leadership

    Top Articles

  • How Does Social Media Bring People Together?
    TTMind Author
  • How to read appSettings JSON from Class Library in ASP.NET Core
    Anil Shrestha
  • Printing Support In Asp.Net Core
    TTMind Author
  • HOW TO EXTRACT TEXT FROM IMAGE USING JAVASCRIPT (OCR with Tesseract.js)?
    Prakash Pokhrel
  • Images Upload REST API using ASP.NET Core
    Prakash Pokhrel
  • Related Topic

  • Hosting ASP.NET Core Web API on IIS
  • Use of TOP and DISTINCT in SQL SERVER
  • What's new in SQL Server 2019?
  • Uploading .csv sample table file data to SQL Server
  • SQL Server Stored Procedures: Part-1
  • Tech
  • About Us
  • Contact Us
  • TechHelp
  • PositiveHelp
  • Jim-Jams Help
  • Terms & Conditions

© Copyright ttmind.com

Main Content

Difference between char, nchar, varchar, and nvarchar in MS SQL Server

Server SQL Server about 7 years ago || 10/9/2018 || 6.9 K View

  • Hide

1. nchar[(n)] (national character)

    i. Fixed-length Unicode string data.

    ii. n defines the string length and must be a value from 1 through 4,000.

    iii. The storage size is two times n bytes.

2. char [(n)] (character)

    i. Non-Unicode string data with fixed-length.

    ii. n defines the string length and must be a value from 1 through 8,000.

    iii. Storage size is n bytes.

 

3. varchar [(n | max)] (character varying)

    i. Variable-length, non-Unicode string data.

    ii. n defines the string length and can be a value from 1 through 8,000.

    iii. max indicates that the maximum storage size is 2^31-1 bytes (2 GB).

    iv. The storage size is the actual length of the data entered + 2 bytes.

4. nvarchar [(n | max)] (national character varying.)

    i. Variable-length Unicode string data.

    ii. n defines the string length and can be a value from 1 through 4,000.

    iii. max indicates that the maximum storage size is 2^31-1 bytes (2 GB).

    iv. The storage size, in bytes, is two times the actual length of data entered + 2 bytes

Reference:

https://docs.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql?view=sql-server-2017

  • 2
  • 0
  • 0
    • Facebook
    • Twitter
    • Google +
    • LinkedIn

About author

Anthony M. Healey

Anthony M. Healey

Touch of Creativity and a bit of active on brain power

Reset Your Password
Enter your email address that you used to register. We'll send you an email with your username and a link to reset your password.

Quick Survey