Results 1 to 6 of 6

Thread: Data Conversion

  1. #1
    Join Date
    Nov 2004
    Posts
    5

    Question Unanswered: Data Conversion

    Hello everyone,

    I am running SQL-2000, I have a table that one field ddefined as char. The data is actually Dollar values(no $ signs just 99.25 for example). I need to convert this column from char to Numeric. I am trying to use Enterprise manager to redesign the table but I get "error converting data type VARCHAR to numeric". Enterprise manager shows the field as CHAR. I have no Idea why that error is comming up. I would like any info that could help me with this conversion. Thanks in advance.

    Ev

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    The isnum function can be used to find values in your data which cannot be converted to numbers:

    select *
    from [YOURTABLE]
    where isnum([VALUEFIELD]) = 0
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Oct 2003
    Posts
    357

    Thumbs up

    Hi you can use the following query
    Code:
    select value=convert(numeric,ddefined) from table
    Madhivanan

  4. #4
    Join Date
    Nov 2004
    Posts
    5
    I ran the ISNUM function and all rows are good. However I get the same error.

  5. #5
    Join Date
    Feb 2004
    Posts
    492
    I might be off here, but perhaps there's a value in there that's a valid numeric but can't be converted from varchar to numeric (see: http://www.dbforums.com/t998353.html) ? Anyway, I ran into the same thing a while back; http://www.dbforums.com/t1023776.html got it solved.

  6. #6
    Join Date
    Nov 2004
    Posts
    5
    You are right. I am not sure why I can't convert to Numeric but I am able to convert to MONEY. Thats works fine for the application. Thanks for your help.

    Ev

Posting Permissions

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