[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Reply - Does SQR Support SYBASE SQL Server 10.x?



>> Does SQR Ver2.5 support SYBASE SQL Server Version 10.x?

I'm using SQR Ver2.5 to SYBASE SQL Server 10.0.1, the following
problem occursed.

    My Probrem ---------------------------------------------------------

        SQR Script
                :
            begin-procedure     proc_a

                let #value = 2

            begin-select
            substring(col, 1, #value)   &res1
            right(col, #value)          &res2
            from    testdata_table
            end-select

            end-procedure
                :
    
    The following error does occur when the execute SQR Script.

        SQR Error File:
            cale error during implicit conversion of NUMERIC value '1.2'
            to a INT field.
            SQL: select substring(col, 1,   1.2), right(col,   1.2)
            from string_func_test
              where 1 = 2

              Error on line 37:
                 (SQR 3716) Error in SQL statement.

                 Errors were found in the program file.
 <<

Hajimemashite

When SQR compiles a program, it first validates the syntax of the SQL
statement by substituting the SQR variables and adding an always false
where clause (where 1 = 2) to it and execute it.  The problem is that SQR
has only 2 types of variables: string and numeric.  When it encounters a
numeric variable, it arbitarily substitutes a decimal value for it.  When
Sybase actually expects an INTEGER, not a DECIMAL, then you will get
the above error.  The workaround is to force the conversion of the SQR
variable to integer.  For your problem, you should code:

            begin-select
            substring(col, 1, convert(int, #value))   &res1
            right(col, convert(int, #value))          &res2
            from    testdata_table
            end-select

Good luck.

Raymond Yip
MTRC
Hong Kong