• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

roxannez
#1 Posted : Monday, April 19, 2010 9:39:16 AM(UTC)
roxannez

Rank: Member

Joined: 8/28/2009(UTC)
Posts: 29

Hi, does anyone have a sql script to purge old records from the database? Thanks.
Customizer
#2 Posted : Monday, April 19, 2010 10:41:25 AM(UTC)
Customizer

Rank: Member

Joined: 9/26/2008(UTC)
Posts: 121

Hi,
If you want to remove all records from table you can write such simple sql script: delete table-name. But such table has relations with others it might be necessary to delete records from other tables.
http://www.software-development-innovations.com - affordable web customization and development service
roxannez
#3 Posted : Monday, April 19, 2010 1:13:14 PM(UTC)
roxannez

Rank: Member

Joined: 8/28/2009(UTC)
Posts: 29

Right, I want to figure out all the tables I should delete the records from.
TMaiden
#4 Posted : Monday, June 28, 2010 1:59:37 PM(UTC)
TMaiden

Rank: Member

Joined: 6/28/2010(UTC)
Posts: 38

In the old days we had a database diagram to show all of the table relationships. If you dont have one of those, you need to look through all of the SQL code to see how the tables are related and which rows need to be deleted in all the related tables, if you want to clear out rows in another table.

Your database may be set up with constraints that will throw errors if you try to clear a table.
Marcus
#5 Posted : Monday, June 28, 2010 5:32:24 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

We do not recommend deleting or adding records directly in the database. Although this can be useful it is much safer and easier to write a small web page with a button. On the button click call into our APIs and delete the items you're interested in.

For example (this is in pseudo code so it's not literal)

For each Product p in Catalog.Products.FindAll()
{
Delete p;
}
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012