FWiW whether a space is after a delimited literal, prior to a new
clause of the SELECT, is of no concern to the SQL.
However that there is no column named DESC and no column named
TEEMES, both of those would be a problem :-) Given the spurious comma
is eliminated and the column reference TEEMES is changed to TEMEES [as
shown in the /original SQL/ which presumably was functional], the SQL
will work either way; with or without the extra space. That is because
the space is just whitespace to the SQL.
Specifically either of the following works fine without error; albeit
the latter is probably considered more readable by most:
and TEMEES = 'FR'ORDER BY AGE DESC'
and TEMEES = 'FR' ORDER BY AGE DESC'
Regards, Chuck
On 07 Mar 2013 12:42, DeLong, Eric wrote:
Add a space....
/space before your order by clause...
'WHERE TEMEMP = TE1EMP and ' + STS + ' ORDER BY AGE,DESC';
Smith, Mike on Thursday, March 07, 2013 2:23 PM wrote:
<<SNIP>>
This is the original SQL statement.
<<SNIP>> WHERE TEMEMP = TE1EMP and TEMEES = 'FR' Order by age desc;
<<SNIP>> Here is where I'm at now.
Select ;
When FPEMP = 'F' ;
Sts = 'TEEMES = ' + Q + 'FR' + Q;
When FPEMP = 'P' ;
Sts = 'TEEMES = ' + Q + 'PT' + Q;
EndSl ;
sqlstring =
'select <<SNIP>>
'WHERE TEMEMP = TE1EMP and ' + STS + 'ORDER BY AGE,DESC';
<<SNIP>>