RE: Need to clear Call table

Mark Colasante ( )
Wed, 22 Jul 1998 14:30:48 -0400

Thanks Dale. I will use these ideas once things are under control.
Problem is that my SQL server won't run any type of query against the
calls table because it times out and also says that there are too many
handles or locks or something to that effect. Are there any foreign
keys reference in the Calls table? If not, then shouldn't I just be
able to truncate the table?


Mark Colasante

-----Original Message-----
From: Dale E. Reed Jr. []
Sent: Wednesday, July 22, 1998 2:08 PM
Subject: Re: Need to clear Call table

Mark Colasante wrote:
> My Calls table is so large right now that a query to it times out.
> I just truncate the Calls table or will this cause problems? Does
> anyone have any stored procs they use to keep only a certain amount of
> call history? If so would you be willing to share those procedures?

Initially, you might want to clean it up by hand. The best way to
do this is just use a statement like this:

Delete From Calls
Where CallDate < '6/1/98'

and then increment the date up and execute it again. Try and only do
pieces at a time. Eventually, you can use a statement like this in
SQL Executive (running nightly or weekly) to trim out the records:

Delete From Calls
Where DateDiff(Month, CallDate, GetDate()) > 2

This would delete all records older than 2 months.

-- Dale E. Reed Jr.  (       IEA Software, Inc.      |  RadiusNT, Emerald, and NT FAQs Internet Solutions for Today  |