money, money, money, money

  • What's up with the money data type in sql?  When I attemp to use it I either get an implicit/explicit conversion to/from varchar error, or an ODBC error.  What should the value for money look like when entering it into the table?

    thanks jm.

  • Janice

       Money is just a decimal field with 4 automatic decimal places.  Of course when you use it with Americano Dollars you should only use the first two decimal place.

      The following script shows the creation of a table with a Money column and inserting some rows. 

        Rick

    set nocount on

    go

    create table dbo.GeeWhizMoney

    (

     GeeMoreMoney Money Not Null

    )

    go

    insert into dbo.GeeWhizMoney (GeeMoreMoney)

    values (12.34)

    insert into dbo.GeeWhizMoney (GeeMoreMoney)

    values (15.5445)

    insert into dbo.GeeWhizMoney (GeeMoreMoney)

    values (15.54452)

    insert into dbo.GeeWhizMoney (GeeMoreMoney)

    values ('$15.49')

    go

    select gwm.GeeMoreMoney

      from dbo.GeeWhizMoney as gwm

    go

    --- Here are the Results

    --GeeMoreMoney

    -----------------------

    --12.34

    --15.5445

    --15.5445

    --15.49

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

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