convert variable to a column name

hwa

New member
Joined
Apr 5, 2007
Messages
4
Programming Experience
Beginner
I have a datarow whereby column names are "DBJAN, DBFEB, DBMAR....DBDEC"
mthvar is a string variable whereby value is "JAN","FEB","MAR" etc
using mthvar, how can I retrieve the respective datarow column

eg, if mthvar is "MAY", to retrieve from "DBMAY" column
mthvar is "AUG", to retrieve from "DBAUG" column
 
note that you have to do this possibly indicates a design fault in your database..
You ought to have a 2 column table where one column is month name and the other is the counter so you can use a WHERE clause
 
Thanks cjard for your reply. Yes, it's a design problem and the solution should be as what you had proposed. But this is an existing application, design by someone else and I had to stick to the design.
 
Back
Top