Error while altering table

  • Hi,

    ALTER TABLE table 1

    ADD column1 money NUlL DEFAULT '0',

    column2 int NUlL DEFAULT '0',

    column3 money NUlL DEFAULT '0'

    while running this i am getting the below error, Please help

    Server: Msg 257, Level 16, State 3, Line 1

    Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query.

    Server: Msg 1750, Level 16, State 1, Line 1

    Could not create constraint. See previous errors.

  • Think a little.

    Read error message again.

    Look at your statement.

    Find where you've got money type declaration and where you're trying to assign varchar value to it.

    _____________
    Code for TallyGenerator

  • Agree with Sergiy. The error tells you the problem.

  • Remove the quotes around the zeros.

    [Code]ADD column1 money NUlL DEFAULT 0,

    column2 int NUlL DEFAULT 0,

    column3 money NUlL DEFAULT 0[/Code]


    Regards,

    goodguy

    Experience is a bad teacher whose exams precede its lessons

  • The script is acceptible in SQL 2005, but not in SQL 2000. You need to remove the quotes for default values.

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

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