nvarchar column can take only half of it''s size

  • I have a table where some columns are definied as "nvarchar" when I try to insert something into this table it takes only half the character of it's size.

    Example:

    (1) When I do a "sp_help" on the table it shows

    type = nvarchar , length= 100

    (2) When I try to insert values it takes max 50 character in this column

    (3) If I do a "generate sql script" then it shows nvarchar(50)

    My question is why is it showing double size when I do "sp_help"  compared to "generte script"

    I will try to see if I can find original script to see how the table was created.

     

     

  • sp_help reports the actual size of the column in bytes.

    nvarchar is unicode, 2 bytes per character, therefore you can only store 50 characters in it, but the physical size of the column is 100 bytes.

  • Thanks PW

    Appreciate your help.

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

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