Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to drop all tables
Message
De
27/02/2008 05:09:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
27/02/2008 05:00:19
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Import/Export
Divers
Thread ID:
01296633
Message ID:
01296763
Vues:
8
>>The real problem is not with dropping in a loop but you can't simply drop a table that has objects depend on it. First you need to drop constraints and such and do dropping in an order, be carefull.
>
>This is a brand new database. It doesn't have any constraint. Also, as I mentioned in the first reply once you provided that code, the error is that it cannot execute it. So, it's either I didn't understand the proper syntax on how to use it or either it's not supported on my version. I have SQL Server 2005.

Oh then (I read it can't find such a procedure-it's a system sp and exists with all databases in SQL2005). Try in Management studio:
use myDatabaseName
go

sp_MSForEachTable 'select * from ? where 1=2'
In your case it would be just as Borislav showed:
sp_MSForEachTable 'Drop Table ?'
? is a placeholder for tablename that is fed into procedure foreach call.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform