SQL Server Performance

INSERT STATEMENT ERROR

Discussion in 'Getting Started' started by menssanvi, Jul 6, 2010.

  1. menssanvi New Member

    I've created a table as shown below but getting this error:.Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.
    CREATE TABLE VAT_MAPPING_DATE
    (
    VAT_CODE numeric(10,0) NULL,
    FROM_DATE numeric(18,0) NULL,
    TO_DATE numeric(18,0) NULL,
    VAT_VALUE DECIMAL(5,3) NULL
    )
    I tried to insert data using the below script:
    INSERT INTO VAT_MAPPING_DATE VALUES ('1','26665','','')
    INSERT INTO VAT_MAPPING_DATE VALUES ('3','39783','40178','0.15')
    INSERT INTO VAT_MAPPING_DATE VALUES ('3','40179','40546','0.175')
    INSERT INTO VAT_MAPPING_DATE VALUES ('3','40547','','0.2')
    Any help will be very much appreciated
    cheers everybody
  2. Adriaan New Member

    If they are numeric values, why are you putting quotes around them in your script?
    Problem could be the use of a full stop as the decimal symbol, which for strings is sensitive to the Regional Settings of the Windows server instance.
  3. FrankKalis Moderator

    It's the empty string in the very first INSERT that causes the error. Check out CAST & CONVERT in BOL. It says:
  4. Adriaan New Member

    Good catch, Frank - I missed that.
  5. Madhivanan Moderator

Share This Page