NVARCHAR - Data Type

  • Hi All,

    A typical issue found in SQL Server 2008, not sure if any one observed.

    I created a table with following SQL:

    CREATE table TESTER (COL_A NVARCHAR(100), COL_B INT, COL_C NUMERIC(18,8));

    When we export the Create Script by Right Click on the table > "Script Table To" > "Create To" > "new Query Window"> Script is As Below

    CREATE TABLE [dbo].[TESTER](

    [COL_A] [nvarchar](100) NULL,

    [COL_B] [int] NULL,

    [COL_C] [numeric](18, 8) NULL

    ) ON [PRIMARY]

    When I try Querying the Meta Data table "SYS.ALL_COLUMNS" using the following Script

    Select * from sys.all_columns where OBJECT_NAME(object_id) = 'Tester'

    Result is:

    name system_type_id user_type_id max_length precision scale collation_name

    COL_A 231 231 200 0 0 Latin1_General_CI_AS

    COL_B 56 56 4 10 0 NULL

    COL_C 108 108 9 18 8 NULL

    Which shows me the Column Size where NVARCHAR is declared is shown double (200 Instead on 100).

    Can some body explain why is this issue occurring, It is screwing the Procedured which are written based on the Meta Data, for Fetching the Create Script of a table.

    please need help.....!

    Thanks,

    Sudhir Nune.

  • Double post.

    Original topic with replies can be found here:

    http://qa.sqlservercentral.com/Forums/Topic1242597-391-1.aspx

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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