Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Deleteing All Rows From Database Expand / Collapse
Author
Message
Posted Tuesday, October 2, 2007 10:03 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, October 10, 2014 2:36 AM
Points: 1,158, Visits: 878
Comments posted to this topic are about the item Deleteing All Rows From Database
Post #406018
Posted Tuesday, October 2, 2007 10:08 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Thursday, November 20, 2014 8:50 PM
Points: 20,584, Visits: 9,623
That's a cool quick and dirty way to do this. However there's always the otion of scripting everything, then creating a new blank db. Both solutions work, it only depends on how urgently you need to wipe out that baby.
Post #406021
Posted Sunday, November 25, 2007 9:19 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, January 22, 2013 8:53 PM
Points: 90, Visits: 141
Be good to see some mods to the script:

1) Check if the table can be truncated (no foreign keys etc) and use Truncate Table instead of delete if this is the case. [Delete logging may take a significant amount of time on large tables]
2) Check the recovery model of the database first and alter it to simple if not already in this state



Post #425533
Posted Wednesday, November 28, 2007 11:36 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 29, 2007 4:43 AM
Points: 1, Visits: 6

First, really appreciate of this script code.

Abhijit, am new to sql server and i know sql in application oriented only not in scripting side.

Could you please explain me how it works and where to run this script.

many thanks

Post #427245
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse