SQL Server – Default Tables in Database

sql server

When I add a new database to our dev server (using SSMS), it automatically creates 5 tables.

These are copies of application tables that already exist in another database.

I assume this is some recent SQL Server feature I don't know about where tables can be marked as 'common' or some such, and so get added automatically to new databases.

But how can I stop it happening?

For the avoidance of confusion, this database is not scripted, it is created directly from the SSMS GUI (right-click Databases > New Database)

(moved from StackOverflow)

Best Answer

This happens (based on the discussion in comments) because the tables exist in the model system database. As per the documentation (my emphasis):

If you modify the model database, all databases created afterward will inherit those changes. For example, you could set permissions or database options, or add objects such as tables, functions, or stored procedures. File properties of the model database are an exception, and are ignored except the initial size of the data file.

As a solution, dropping the tables from model will stop this phenomenon.