sql - Multiple stored procedures for a purge script? -
sql - Multiple stored procedures for a purge script? -
i in process of creating purge script in vbscript, deletes records tables if more 1 month old.
the criteria each table different, , there both parent , kid tables (i.e. latter dependent on former retrieving id codes , upload statuses).
my question: should each delete
block each table created separate procedure, including kid , parent deletions? how best , efficiently handled?
a sample of sql code:
delete teststaging.dbo.spindataentries teststaging.dbo.spindataentries.spindataid in (select teststaging.dbo.spindata.spindataid teststaging.dbo.spindata teststaging.dbo.spindata.uploadstatus in ('f', 'c') , lastuploaded < dateadd (m,- 1,sysdatetime())); delete teststaging.dbo.spindata teststaging.dbo.spindata.uploadstatus in ('f', 'c') , lastuploaded < dateadd (m,- 1,sysdatetime());
should each of these 2 blocks, remaining code, logged separate stored procedures, , called separate, main vbscript?
unless have requirement able run each statement separately it's more efficient wrap them in single stored procedure.
sql vbscript purge
Comments
Post a Comment