SQL Server Size Difference for a Column

In my SQL table in SQL Server they say "Temp" and there are columns Addr1, Addr2, Addr3, Addr4 and some additional columns.

These Addr1, Addr2, Addr3 and Addr4 are nvarchar types. when I check the size of this column on the explorer object. it shows all of them in nvarchar (100).

enter image description here

But when I test them using Alt + F1. It shows details in the results area with a length of 200. The screenshot is below.

enter image description here

why are there different? If I enter more than 100 characters, do I get truncation errors? it looks like it only takes 100 characters.

can you tell me what sets the length value?

Thank you Prakash.

+4
1

, , , , sp_help, - .

VARCHAR SQL 1 , NVARCHAR 2 . 2 - . . , NVARCHAR, 200 ( , 202) 100 , VARCHAR 100 ( 102).

:

MSDN: char varchar

- + 2 .

MSDN: nchar nvarchar:

+ 2 .

( )

MSDN: sp_help:

( , sys.sysobjects), .

    /------------------------------------------------------------------------\
    | Column name | Data type | Description                                  |
    |-------------+-----------+----------------------------------------------|
    |   Length    | smallint  | Physical length of the data type (in bytes). |
    \------------------------------------------------------------------------/
+9

Source: https://habr.com/ru/post/1665872/


All Articles