Drop all objects in MS-SQL db that belong to different schema's?
Is there a way to drop all objects in a db, with the objects belonging to
two different schema's?
I had been previously working with one schema, so I query all objects
using: Select * From sysobjects Where type=..., then dropped everything I
using Drop Table .... Now that I have introduced another schema, every
time I try to drop it says something about I don't have permission or the
object does not exist. BUT, if I prefix the object with the
[schema.object] it works. I don't know how to automate this, cause I don't
know what objects, or which of the two schema's the object will belong to.
Anyone know how to drop all objects inside a db, regardless of which
schema it belongs to?
(The user used is owner of both schema's, the objects in the DB were
created by said user, as well as the user who is removing the objects
-which works if the prefix i used IE. Drop Table Schema1.blah)
 
No comments:
Post a Comment