Sql-Server

sql server India
  • 13 years ago

    Hi,

                   I had to change a columns datatype from money to varchar(100)...I have data in my table..I am using sql-server 2005..I tried the following coding..

    ALTER TABLE bb
    ALTER COLUMN dealercost varchar(100) NOT NULL

    It gives me an error as:

    Msg 260, Level 16, State 1, Line 1
    Disallowed implicit conversion from data type money to data type varchar, table 'ACIG01_DSV.dbo.bb', column 'DealerCost'. Use the CONVERT function to run this query.


    Plz Help..

    Thanks in advance

  • 13 years ago

    Dear Jeni,

     

    DECLARE @mymoney    money;
    SET  @mymoney    = 3148.29;
    SELECT  CAST(@mymoney AS decimal)    AS 'MONEY DECIMAL';

    Hope this helpfulConfused

    Check me on my blog: http://dflorence25.blogspot.com

  • 13 years ago

    Hi,

     

    Thanks for u r reply..

    could u help me out in rewriting the above code with the cast function...

     

    Thanks in Advance

     

  • 13 years ago

    Dear Jeni

    mail me your coding snippets and i will give u the full code.

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Every language has an optimization operator. In C++ that operator is ‘//’”