Author |
Message
|
Vamsi Krishna |
Posted: Tue Mar 17, 2015 9:10 pm Post subject: Calling Database table values Dynamically |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
Hi All,
I am working on a task to retrieve table values from sql server database for exchange rates. I am using select statement by using select.* iam able to retrieve the values but the modification i received is if the client needs only one column values from 9 columns i have to call the values dynamically from database. I have tried using select variable the variable is having the column name but the select statement printing the column name all times into the Environment. Anyone help me how to execute this statement  |
|
Back to top |
|
 |
ganesh |
Posted: Wed Mar 18, 2015 8:09 am Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Is your requirement create sql query dynamically based on the input?
Create stored procs for all possible combinations and call them based on the request. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Mar 18, 2015 8:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You could potentially use EVALUATE... but it comes with a performance cost...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Wed Mar 18, 2015 6:55 pm Post subject: |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
ganesh wrote: |
Is your requirement create sql query dynamically based on the input?
Create stored procs for all possible combinations and call them based on the request. |
Yes my requirement is calling the sql query dynamically ok i will try with the stored procedures |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Thu Mar 19, 2015 6:38 pm Post subject: |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
Vamsi Krishna wrote: |
ganesh wrote: |
Is your requirement create sql query dynamically based on the input?
Create stored procs for all possible combinations and call them based on the request. |
Yes my requirement is calling the sql query dynamically ok i will try with the stored procedures |
I am able to retrieve data from database i had used some conditional statements in esql and iam able to receive data from the database. |
|
Back to top |
|
 |
mgk |
Posted: Fri Mar 20, 2015 10:52 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
You may find that PASSTHRU helps with this as it allows you to construct queries to send to the DB dynamically. And the performance is the same as regular ESQL queries (assuming you use parameter markers) and is much better than EVAL.
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
Vamsi Krishna |
Posted: Mon Mar 23, 2015 12:48 am Post subject: |
|
|
 Acolyte
Joined: 12 May 2014 Posts: 53
|
mgk wrote: |
You may find that PASSTHRU helps with this as it allows you to construct queries to send to the DB dynamically. And the performance is the same as regular ESQL queries (assuming you use parameter markers) and is much better than EVAL.
Kind regards, |
Thanks mgk i will check with the PASSTHRU statement |
|
Back to top |
|
 |
|