You want to dynamically call the db based on the db properties? As far as I know this can't be done directly. However, you can try using CASE statements...depending on how many actions you are performing this can get verbose. Sample:
SELECT fieldname1, fieldname2, ..., fieldnameN,
CASE WHEN...