Link to home
Create AccountLog in
Avatar of PKTG
PKTGFlag for United States of America

asked on

How to delete different database table records via SSIS?

I want to delete 30 days old data from different database table. All database in same server.  I like to do this task via SSIS and schedule the job. I thought i can write the below script in one execute sql task . But in connection manager i can give only one database. I don't know how to pass  different database in connection manager. Pls help me.

DELETE FROM db1..table1 WHERE convert(varchar,starttime,112)<convert(varchar,dateadd(dd,-30,getdate()),112)
DELETE FROM db2..table2 WHERE convert(varchar,starttime,112)<convert(varchar,dateadd(dd,-30,getdate()),112)
DELETE FROM db3..table3 WHERE convert(varchar,starttime,112)<convert(varchar,dateadd(dd,-30,getdate()),112)
DELETE FROM db4..table4 WHERE convert(varchar,starttime,112)<convert(varchar,dateadd(dd,-30,getdate()),112)
ASKER CERTIFIED SOLUTION
Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of PKTG

ASKER

Wow. It is working fine Thanks. I never try this before. Cool