I have multiple mssql databases that have similar or even identical tables. I want to build one app that can be used across multiple databases, and the queries know which database to use based on a select box.
So I want to do something like...
USE {{selDB.value}}
SELECT * FROM addresses
Right now I have something gross like...
IF {{selDB.value}} = 'database1'
BEGIN
use database1
END
ELSE IF {{selDB.value}} = 'database2'
BEGIN
use database2
END
ELSE IF {{selDB.value}} = 'database3'
BEGIN
use database3
END
SELECT * from addresses
And there are a lot of databases and I have to copy and paste that into every query in the app.
Suggestions????
Is there a way to change the Resource for a query dynamically?