Switching User's Active Default DB

Hello,

I am working on a project that can be used by multiple users for different projects they are working on. Each project has a SQL database associated with it, so moving to a different project means connecting to a different database. In the project, we have scripting that uses database name parameters to execute scripted queries, however, we also are using named queries. Right now, the way to select a new database is a setting dropdown that writes to an admin database the current "linked" database to that user's account.

Is there a script or some other way to change the user's default database at will?

Thank you!

Named Queries allow the Database Connection to be supplied as a parameter, so you should be able to use them in a similar way that you are doing so with scripting.

3 Likes

Not the way I was thinking, but this might actually be a better solution. Thank you!