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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -