Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    9

    Unanswered: Money data type for handling comma instead period

    I have created a table with money datatype by default it accepts period for decimal degit, But if I change the regional settings with Italian format, I am getteting error in insert statement due to comma in the money format. I would like to write insert statement that works for both and US and italian format, Please help me.
    Last edited by venki; 11-26-03 at 13:56.

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245

    Re: Money data type for handling command instead period

    Me personally, I would avoid the money data type and use an integer data type. You have to do more work on the front end to handle displaying information, but I have read of too many instances of rounding errors being introduced because of decimal data types (money, decimal, float, real).

    hmscott

  3. #3
    Join Date
    Nov 2003
    Posts
    9

    Money Datatype

    But I have already developed the product it is difficult for me to change the data structure at this time. I am just trying to find out some solution here. Is it possible for me to use syntax like cast or convert to solve this issue?

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Really?

    Can you post an example?

    And when could you ever insert a comma in a number? It would think it's another data element...

    Code:
    USE Northwind
    GO
    
    CREATE TABLE myTable99 (Col1 money)
    GO
    
    INSERT INTO myTable99(Col1) SELECT 12345678.1234
    INSERT INTO myTable99(Col1) SELECT 12345678.8765
    
    SELECT SUM(Col1) FROM myTable99
    
    INSERT INTO myTable99(Col1) SELECT 12,345,678.1234
    
    DROP TABLE myTable99
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Nov 2003
    Posts
    9

    Money Datatype

    Here is the syntax, I am using vb.net application to create the sql statement string

    dim MoneyValue as double = 123.99

    sql = "insert into mytable (mymoney) values (123.99)"

    if the regional setting is US format then it is inserting OK due the decimal sign is period

    If the regional setting is itallian then it is giving error due to the following syntax.

    sql = "insert into mytable (mymoney) values (123,99)"

    Note: it is using comma for the decial seperator

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •