ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Select query table name from a variable

Post new topic  Reply to topic
 Select query table name from a variable « View previous topic :: View next topic » 
Author Message
aggarwal.intouch
PostPosted: Thu Jul 31, 2014 11:36 pm    Post subject: Select query table name from a variable Reply with quote

Acolyte

Joined: 30 May 2011
Posts: 56
Location: India

I'm trying to give table name in a variable and later trying to pick table name from that variable in my select query. But this is not working. Any suggestions???

set TABLE = 'TEST'

SET value=(SELECT MAX (Z.DATE_STEHT) FROM Database.TABLE AS Z
Back to top
View user's profile Send private message Send e-mail
aggarwal.intouch
PostPosted: Fri Aug 01, 2014 12:02 am    Post subject: Reply with quote

Acolyte

Joined: 30 May 2011
Posts: 56
Location: India

Found solution of my query. Although there was no rocket science behind that.

Solution : Keep variable in curly braces.

Code:
set TABLE = 'TEST'

SET value=(SELECT MAX (Z.DATE_STEHT) FROM Database.{TABLE} AS Z
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Fri Aug 01, 2014 5:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Back to top
View user's profile Send private message
ganesh
PostPosted: Fri Aug 01, 2014 5:50 am    Post subject: Reply with quote

Master

Joined: 18 Jul 2010
Posts: 294

Did you try a different variable name, "TABLE" could be a key word.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Select query table name from a variable
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.