|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Syntax error in esql for sql queries with top, order by |
« View previous topic :: View next topic » |
Author |
Message
|
kpravin |
Posted: Fri Jan 23, 2015 5:34 am Post subject: Syntax error in esql for sql queries with top, order by |
|
|
Newbie
Joined: 21 Jan 2011 Posts: 3
|
Hi,
I have to run a sql query in esql as below, but it fails with syntax error.
Simple select query works fine.
Can you please check and help in syntax error for below sql query.
select top(1) employeeId, amount ,paidamount from dbname.schema.tablename
where [deliveryStatus ]= 'Pending'
and employeeId = '12345'
order by creationDate desc
Regards,
Pravin |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 23, 2015 5:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
That's an SQL select statement.
It's not an ESQL select statement. |
|
Back to top |
|
 |
vrboya |
Posted: Fri Jan 23, 2015 9:21 am Post subject: |
|
|
Newbie
Joined: 20 Jul 2013 Posts: 7
|
Try to run the sql query use a PASSTHRU code
Syntax looks something like this
DECLARE cSQLQuery CHARACTER;
SET cSQLQuery = 'select top(1) employeeId, amount ,paidamount from dbname.schema.tablename
where [deliveryStatus ]= 'Pending'
and employeeId = '12345'
order by creationDate desc
SET Environment.Variables.MetaInfo.SqlResult[] = PASSTHRU (cSQLQuery);
Your query results will be in an array form in the environment variables. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 23, 2015 10:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
vrboya wrote: |
Try to run the sql query use a PASSTHRU code |
Ah, good point. I missed the order by clause. ESQL Select doesn't support ORDER BY or GROUP BY. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|