nchar/char

  • What difference between these two data types?

  • nchar is a unicode datatype an uses two bytes per character.

    Check "Data Types" topic in Books Online.

    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

  • Piggy-backing on Phill's answer, this might illustrate it

    
    
    DECLARE @a NCHAR(15)
    DECLARE @b CHAR(15)

    SET @a='Why Unicode?'
    SET @b = @a
    SELECT DATALENGTH(@a)as DoubleSize, DATALENGTH(@b) as NotDoubleSize

    Frank

    http://www.insidesql.de

    Edited by - Frank Kalis on 10/27/2003 12:56:16 AM

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Sorry, you should see something like

    
    
    DoubleSize NotDoubleSize
    ----------- -------------
    30 15

    (1 row(s) affected)

    Frank

    http://www.insidesql.de

    Edited by - Frank Kalis on 10/27/2003 12:58:00 AM

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply