![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
It there an easy way to 'clean out' a SQL Server database? I need to get a database of an unknown state back to a known state of 'empty'. Is there an easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?) (I don't want to rely on Dropping the Database and recreating it entirely as a new database, since this requires a priviledge escalation as compared to the priviledges required for working on structures inside of the database.) Thanks for your help! - Joseph Geretz - |
#3
| |||
| |||
|
|
It there an easy way to 'clean out' a SQL Server database? I need to get a database of an unknown state back to a known state of 'empty'. Is there an easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?) (I don't want to rely on Dropping the Database and recreating it entirely as a new database, since this requires a priviledge escalation as compared to the priviledges required for working on structures inside of the database.) Thanks for your help! - Joseph Geretz - |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Here's a link to a script to drop all user objects using the basic technique Louis suggested. You can tweak for SQL 2005, although the need to do this might be mitigated if you can do DROP/CREATE DATABASE instead. http://tinyurl.com/9t9m6 -- Hope this helps. Dan Guzman SQL Server MVP "Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:ezib0ueHGHA.2040 (AT) TK2MSFTNGP14 (DOT) phx.gbl... It there an easy way to 'clean out' a SQL Server database? I need to get a database of an unknown state back to a known state of 'empty'. Is there an easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?) (I don't want to rely on Dropping the Database and recreating it entirely as a new database, since this requires a priviledge escalation as compared to the priviledges required for working on structures inside of the database.) Thanks for your help! - Joseph Geretz - |
#6
| |||
| |||
|
|
Here's a link to a script to drop all user objects using the basic technique Louis suggested. You can tweak for SQL 2005, although the need to do this might be mitigated if you can do DROP/CREATE DATABASE instead. http://tinyurl.com/9t9m6 -- Hope this helps. Dan Guzman SQL Server MVP "Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:ezib0ueHGHA.2040 (AT) TK2MSFTNGP14 (DOT) phx.gbl... It there an easy way to 'clean out' a SQL Server database? I need to get a database of an unknown state back to a known state of 'empty'. Is there an easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?) (I don't want to rely on Dropping the Database and recreating it entirely as a new database, since this requires a priviledge escalation as compared to the priviledges required for working on structures inside of the database.) Thanks for your help! - Joseph Geretz - |
![]() |
| Thread Tools | |
| Display Modes | |
| |