Preview:
// First, store table names in a variable
LET vTableList = '';

FOR i = 0 to NoOfTables() - 1
    LET vTable = TableName($(i));
    IF '$(vTable)' <> '$(t)' THEN
        TRACE 'Adding Table: $(vTable)';
        LET vTableList = If(len(vTableList)>0, '$(vTableList)|', '') & '$(vTable)';
    ENDIF;
NEXT i;

// Drop tables outside the initial loop
LET vTableCount = SubStringCount('$(vTableList)', '|') + 1;
FOR i = 1 to $(vTableCount)
    LET vDropTable = SubField('$(vTableList)', '|', $(i));
    TRACE 'Dropping Table: $(vDropTable)';
    DROP TABLE [$(vDropTable)];
NEXT

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter