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 » Using Variable column names with DB

Post new topic  Reply to topic
 Using Variable column names with DB « View previous topic :: View next topic » 
Author Message
ghada
PostPosted: Tue Oct 03, 2006 6:10 am    Post subject: Using Variable column names with DB Reply with quote

Apprentice

Joined: 13 Oct 2005
Posts: 41
Location: Egypt

Hi All
Im using WBIMB6, Im trying to use the following select Statemnet
The table name and Column Name are both variables
It is as followed

SET ExistedCode = 'XYZ' ;
SET TableName = Environment.Variables.Code_Table;
SET StandardTableName = nvironment.Variables.Standard_Table;
SET StandardFieldName = Environment.Variables.Standard_Field;

SET Environment.Variables.Standard[] =( SELECT ITEM ST.ID FROM Database.AL.{StandardTableName}AS ST WHERE Database.AL.{StandardTableName}.{StandardFieldName} = ExistedCode);

but this is not working, I tried Also:

SET Environment.Variables.Standard[] =( SELECT ITEM ST.ID FROM Database.AL.{StandardTableName}AS ST WHERE ST.{StandardFieldName} = ExistedCode);

it didnt work either
is it possible to give the column name as variable

thanks in advance

Ghada
Back to top
View user's profile Send private message Yahoo Messenger
ghada
PostPosted: Mon Oct 09, 2006 12:18 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2005
Posts: 41
Location: Egypt

hi all
I found some work around to solve my problem, but I hope I can find better solution

SET Quotation =SUBSTRING('g''h' FROM 2 FOR 1); -- in order to have Quotation ='

SET SQL_STATMENT = 'SELECT ID FROM AL.' || StandardTableName ||' WHERE '|| StandardFieldName||' = '||Quotation||ExistedCode||Quotation ;

SET Environment.Variables.PASSTHRU_Standard[] =PASSTHRU(SQL_STATMENT);

as this statement returned the name value paire I had to do the following select to get the value only
SET Environment.Variables.Standard[]= (SELECT ITEM E.ID FROM Environment.Variables.PASSTHRU_Standard[] AS E);

I will be glad to hear better sugesstions

Ghada
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Using Variable column names with DB
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.