In SQL Server Management Studio, I repeatedly manage to run sql scripts against the master database rather the specific database that I intend. I open a SQL file and then click run, repeatedly forgetting to set the database first.
I know you can set a default for a server connection - but then I might end up running sql on the default database rather than my intended one if my intended one is not the default.
USE statements in the sql won't work either - the scripts need to be run against multiple different test databases.
So is there anyway to flag a warning that the script is about to be run against the master database? Or possibly force the selection of a database first before a script is run?