
Parsing SQLServer SQL/ENDSQL on v6.2
#1
Posted 17 June 2010 - 03:00 PM
This will fall over with an SQL error
SQL
SELECT * FROM <TABLE>
WHERE :$ABC = 'Y'
OR
:$ABC = 'X'
ENDSQL
whereas this won't:
SQL
SELECT * FROM <TABLE>
WHERE :$ABC = 'Y'
OR
(:$ABC = 'X')
ENDSQL
and neither will this:
SQL
SELECT * FROM <TABLE>
WHERE :$ABC = 'Y'
OR :$ABC = 'X'
ENDSQL
The problem is the parser effectively produces
OR:$ABC = 'X'
instead of
OR<space>:$ABC = 'X'
when the OR (same for an AND) ends the line and the next line doesn't start with a bracket.
The version that fails on SQLServer works fine on Oracle.
ProIV accept it's a bug and hopefully it will be fixed.
This is your captain speaking. We may experience some slight turbulance and then...explode.
#2
Posted 18 June 2010 - 04:01 PM
SQL
SELECT * FROM <TABLE>
WHERE :$ABC = 'Y'
OR :$ABC = 'X'
ENDSQL
Could be done as:
$X_STRING = ' OR ' + $ABC + ' = ' + CHAR(39) + 'X' + CHAR(39) + CHAR(32)
SQL
SELECT *
FROM <TABLE>
WHERE :$ABC = 'Y'
:$X_STRING
ENDSQL
#3
Posted 19 June 2010 - 10:42 AM
There's no need for such an elaborate work-around. Just having the OR on the same line of logic as the :$ABC = 'X' works. The parser screws up when you have OR on one line and :$ABC = 'X' on the next line.
FYI - The following would probably be a good work-around
SQL
SELECT * FROM <TABLE>
WHERE :$ABC = 'Y'
OR :$ABC = 'X'
ENDSQL
Could be done as:
$X_STRING = ' OR ' + $ABC + ' = ' + CHAR(39) + 'X' + CHAR(39) + CHAR(32)
SQL
SELECT *
FROM <TABLE>
WHERE :$ABC = 'Y'
:$X_STRING
ENDSQL
This is your captain speaking. We may experience some slight turbulance and then...explode.
#4
Posted 21 June 2010 - 08:47 PM
Hi,
There's no need for such an elaborate work-around. Just having the OR on the same line of logic as the :$ABC = 'X' works. The parser screws up when you have OR on one line and :$ABC = 'X' on the next line.

Ah, okay, I slightly misunderstood the post then...
#5
Posted 21 July 2010 - 02:01 PM
Hi,
There's no need for such an elaborate work-around. Just having the OR on the same line of logic as the :$ABC = 'X' works. The parser screws up when you have OR on one line and :$ABC = 'X' on the next line.
![]()
Ah, okay, I slightly misunderstood the post then...
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users