Posted: Tue May 31, 2011 9:52 pm Post subject: Dynamically setting Datasource name in query
Acolyte
Joined: 09 Feb 2011 Posts: 68
Hi,
My query is like this
SET Environment.Variables.ConfigData.OTA_Chain_Codes[]=PASSTHRU ('SELECT CHAIN_CD FROM HTLCONT.CHAIN WHERE CHAIN_ID IN(SELECT CHAIN_ID FROM HTLCONT.SRC_CHAIN_ASOC WHERE SRC_ID IN(SELECT SRC_ID FROM ESBLYR.APP WHERE APP_ID=?))' TO Database.ESBLYR VALUES (appID));
We have a requirement that we need to override this value for each environment as DSN name differs.
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
Vanshul_MB wrote:
I just DECLARE a CHARACTER for my testing.But it gives an error.
DECLARE DBName CHARACTER 'ESBLYR';
Did you try the {} around the name
Code:
SET Environment.Variables.ConfigData.OTA_Chain_Codes[]=PASSTHRU ('SELECT CHAIN_CD FROM HTLCONT.CHAIN WHERE CHAIN_ID IN(SELECT CHAIN_ID FROM HTLCONT.SRC_CHAIN_ASOC WHERE SRC_ID IN(SELECT SRC_ID FROM ESBLYR.APP WHERE APP_ID=?))'
TO Database.{ESBLYR} VALUES (appID));
_________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
I just DECLARE a CHARACTER for my testing.But it gives an error.
DECLARE DBName CHARACTER 'ESBLYR';
Did you try the {} around the name
Code:
SET Environment.Variables.ConfigData.OTA_Chain_Codes[]=PASSTHRU ('SELECT CHAIN_CD FROM HTLCONT.CHAIN WHERE CHAIN_ID IN(SELECT CHAIN_ID FROM HTLCONT.SRC_CHAIN_ASOC WHERE SRC_ID IN(SELECT SRC_ID FROM ESBLYR.APP WHERE APP_ID=?))'
TO Database.{ESBLYR} VALUES (appID));
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