Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

T-sql Datatypes Expand / Collapse
Author
Message
Posted Monday, October 27, 2008 1:06 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, December 2, 2009 12:19 AM
Points: 108, Visits: 248
hello,

what is the difference between the
NCHAR() AND NVARCHAR()


Regards:
Dastagiri.D


Thanks
Dastagiri.D
Post #591934
Posted Monday, October 27, 2008 1:23 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 8:57 AM
Points: 3,138, Visits: 1,060
nchar

Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. The storage size is two times n bytes. The ISO synonyms for nchar are national char and national character.

nvarchar

Variable-length Unicode character data. n can be a value from 1 through 4,000. max indicates that the maximum storage size is 2^31-1 bytes. The storage size, in bytes, is two times the number of characters entered + 2 bytes. The data entered can be 0 characters in length. The ISO synonyms for nvarchar are national char varying and national character varying



Post #591942
Posted Monday, October 27, 2008 1:29 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 2:56 AM
Points: 211, Visits: 548
nChar() is Fixed length
and nVarChar is variable length.

In practice, the disk space used is
nChar(5) => will always use 12 Bytes ( 2 *n ) +2
nVarChar(5) = > uses 3 ( ( 1*2)+2 Bytes ) up to 12 Bytes depending on number of characters entered and ansi-Padding settings.

Check BOL nChar and nVarchar for more details



Post #591944
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse