sp_MSforeachtable unable to delete referenced tables

  • I want to drop all tables from database..

    when i run sp_MSforeachtable, it drops some tables but left rest of tables becoz of referencial constraint

    In oracle we can use cascade constraints option while dropping table!

    Is their any way to do same in sql server 2005

    Or is their any other procedure(sql script) instead of sp_MSforeachtable to drop all tables from database.

  • Yes. In the SSMS Explorer pane, right-click on the database and pick "Tasks > Generate Scripts". From these script drops for all of your tables, and include "Dependent Objects".

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

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