I have a database full of customer data. It\'s so big that it\'s really cumbersome to operate on, and I\'d rather just slim it down to 10% of the customers, which is plenty
Kevin post is incomplete, his t-sql sp only prints the command, to execute these command, before last end add this
DECLARE @commandText VARCHAR(8000)
DECLARE curDeletes CURSOR FOR
select 'delete from [' + table_name + '] where ' + criteria from @to_delete order by id desc
OPEN curDeletes
FETCH NEXT FROM curDeletes
INTO
@commandText
WHILE(@@FETCH_STATUS=0)
BEGIN
EXEC (@commandText)
FETCH NEXT FROM curDeletes INTO @commandText
END
CLOSE curDeletes
DEALLOCATE curDeletes