New database contains tables/view/Store Procs

  • On my SQL database when ever I create a new database it contains table, views and Stored Procedures from an old database I created sometime ago.

    Why and how can I get rid of them?

    <<<Bryan>>>

  • If you have the objects created in your model database every new database you create will also have them .

    I'd have a look, clean out the model database to prevent any future issues then drop and recreate your db from scratch (or just drop them in the DB, your choice)

  • To expand Mike's post a bit. Whenever you create a new db, SQL Server copies the model db behind the scenes. When you have freshly installed SQL Server, a newly created db should contains 21 objects; 19 system tables and 2 views, IIRC. When you see more objects and/or other you have at some point in time created your own objects in model. These will now also get copied into the new db.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Magic, that's the one.

     

    Many thanks  🙂

  • Be careful with the MODEL database.  Other developers/DBA might be expecting and needing these objects when a database is created.  Better to be sure that these objects are indeed eronious.


    -Isaiah

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply