sql-servermanagement-studio-express

CREATE DATABASE ends up cloning an old database


I have run into something quite odd, i haven't had this issue before, or maybe i'm missing something here.

In SQL Server Management Studio 2012 i am trying to run a Query to create a new database but it ends up cloning an old database, the code i'm using is:

CREATE DATABASE SEC_SSG_INOUT;
GO

USE SEC_SSG_INOUT;
GO

The database gets created with the correct name but it contains the same tables and stored procedures as an old database called SEC_SSG, but with empty data.

What is going on here?


Solution

  • You must have added these objects to your model database by mistake at some point.

    This gets used as the template for all new databases. Any objects created in there will be present in new databases CREATE-ed.