Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    10

    Question Unanswered: Problem using Convert Function in ISQL

    I am using iSQL on Sybase 12.5.1
    I am facing the problem while using the convert function for converting Char datatype to Numeric as :

    SELECT CONVERT(NUMERIC(11,2), ISNULL(value,'0'))

    where value is character type of data in a table, but I have received the following error message

    Server Message: Number 249, Severity 16
    Server 'prodphx', Line 1:
    Syntax error during explicit conversion of VARCHAR value '322,000.00' to a NUMERIC field.

    This happened on the data only when there is Numeric data with comma separated and decimal values & give the correct result, if there is only inter data as "123456" etc. How I can convert data with commas and decimal ??

  2. #2
    Join Date
    Feb 2003
    Posts
    6
    Hi,

    You may need to convert to money type first. I was able to get this to work:

    SELECT convert(numeric(11,2), CONVERT(money, ISNULL('322,000.00','0')))

    --------------
    322000.00



    john

Posting Permissions

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