Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing old Records from Table.

Status
Not open for further replies.

EduardoYus

IS-IT--Management
Oct 11, 2005
44
0
0
US
Greetings,

I do not have any (or much) SQL experience, if I'm on the wrong forum, please point me in the right direction.

We have a SQL Calendar/Appointment application that was custom built for us 3 years ago, the table where the appointments are kept has continued to grow.

I would like to delete any appointments older than 1 year from it hoping that will speed things up. It is accessed from a WEB interface.

Is there a simple way to do this ?

Many Thanks.
 
well basic syntax would be


delete from table_name where date_column < '2005-08-08 00:00:00.000'

be sure to take a backup, before you run the query. if you need further help with the exact syntax of the query thenplease give your table structure.
 
I'd check the amount / size of records before deleting them all in 1 hit. There's a potential to fill the log file if there's loads of them. I had a developer do a delete statement for 1 years worth of data on a live system (don't know how he had access!!) and it tried to delete 3 million rows and crashed the server. It may be worth looking into starting at the oldest and doing a month at a time, but without knowing the dataset it's difficult to offer precise advice.

Rgds,

M.
 
Thanks, I'll try that and let you know how it goes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top