• First of all, put the criteria for the delete in the delete statement and do it in a set-based manner, not a RBAR (Row By Agonizing Row) method.

    Here is a very simple example:

    create table dbo.MyTable (

    MyTableID int identity(1,1) primary key,

    MyTableData1 varchar(10),

    MyTableDate1 datetime

    ); -- create the test table

    insert into dob.MyTable(MyTableData1, MyTableDate1)

    select 'Joe', '2007-10-01' union all

    select 'Sam', '2008-10-01'; -- insert some test data

    select * from dbo.MyTable; -- show the data

    delete from dbo.MyTable

    where MyTableDate1 < '2008-08-01'; delete some data

    select * from dbo.MyTable; -- show what's left

    drop table dbo.MyTable; -- drop the test table