How to do it...
Follow these steps to create a subroutine to store QVD then drop a table:
Before the load statement for Table1, add the following script:
Sub StoreAndDrop(vTableName)
Store [$(vTableName)] into [$(vTableName).qvd];
Drop Table [$(vTableName)];
End Sub
After the Table1 load and before the Table2 load, add the following line of script:
Call StoreAndDrop('Table1');
After the Table2 load, add the following line of script:
Call StoreAndDrop('Table2');
Reload the script. There should be no data in the document and two QVD files should have been created in the same folder as the QVW file.