mardi 14 juin 2016

Want to loop through all tables in sql DB & perform some operation on the record which contain current datetime in different tables

i am stuck at a point where i need to go through all the tables in DB and perform some query on the record which get match to current datetime(datetime is previously stored in tables as enddate).

so i have number of tables in my DB which tables have names like '%_PHGH_LINK_DETAILS', starting of each table is username
ex: if username is john then table name is john_PHGH_LINK_DETAILS.

I want to loop through all these tables & get those records which match enddate to current date. The records which match enddate to current datetime will be updated & same record get inserted in another xyz table. i want to put this querfory in event so it keep checking all tables after particular time interval that if some record hits endtime. someone please guide me with code.

Aucun commentaire:

Enregistrer un commentaire