I have executed a query from .sql file in SSMS which starts with the "USE" query:
use mydatabase
Go
However there was a typo in mydatabase. it was myddatabase and I received the following error:
Database 'myddatabase' does not exist. Make sure that the name is entered correctly.
After that there are a lot of successsful insert
queries with the following message:
(1 row affected)
So I am afraid if those queries where executed on another database. How can I find which database was affected? Is there a default database?
You have updated database that was active before USE
statement.
That means if master
database was active and you write statement for example
USE myddatabase
and this statement produce an error all lines below after GO
are executed in the master
.
You can easily see always which database is active at the bottom right corner of your SSMS
.