$allfiles=array("01","02","03","04","05","06","07","08","09","10","11","12","13"); $allsec=array("BLOK_COV","BLOK_KR","BLOK_PG","BLOK_PB","BLOK_CI","BLOK_TKP","BLOK_CP","BLOK_TII","BLOK_RHPJ"); foreach ($allfiles as $value) { exec("copy semi2013.mdb semi2013_temp.mdb"); foreach ($allsec as $sec) { $ms=""; if ($value=="05" & $sec=="BLOK_KR"){ $ms="UPDATE $sec SET kr01=1 WHERE cso_wilcah='05072' AND id='3' AND noresp='004'\r\n"; } filewrite("semi2013.qry","$ms DELETE * FROM $sec WHERE mid(cso_wilcah,1,2)<>'$value'"); exec("iipw mdbquery semi2013_temp.mdb semi2013.qry"); } exec("cscript compact.vbs semi2013_$value.mdb"); }Compact mdb using vbs:
Dim Engine Set Engine = CreateObject("JRO.JetEngine") Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\project\SUM2\annual_survey\2013-02\data\mdb\SEMI2013_temp.mdb","Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\project\SUM2\annual_survey\2013-02\data\mdb\" & WScript.Arguments.Item(0)
*just to avoid forgetting*
No comments:
Post a Comment