Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
Do you know if I can do something like this?
DROP TABLE table*;
If I had a lot of tables like 'table1', 'table2',....'table300' and I´d like to dropt it, could be an easy way to delete all the tables.
I know that I can make a For..Next to delete all the tables, but I dont know if I can use regular expressions.
Thanks a lot.
The simple answer is no. Tables must be explicitly listed and there's no support for regular expressions.
But if your actual testing can be done with a wildmatch(), you could handle it by looping through all the tables, like so:
FOR i=nooftables()-1 TO 0 STEP -1
LET vTable=tablename(i);
IF wildmatch(vTable,'table*') THEN
DROP TABLE $(vTable);
END IF
NEXT
I know it's an irritating answer, but: why?
I mean, if you have numbered tables containing similar values, why you do not load them in a single, common table instead of loading them separatedly?
Probably I'm missing something.
Bye
Hi chisea80,
My question is not about how to load tables with similar values.
My question is about if I can use a regular expression to delete some tables at the same time, this tables could be similar or not it doesn´t matter.
Thanks.
The simple answer is no. Tables must be explicitly listed and there's no support for regular expressions.
But if your actual testing can be done with a wildmatch(), you could handle it by looping through all the tables, like so:
FOR i=nooftables()-1 TO 0 STEP -1
LET vTable=tablename(i);
IF wildmatch(vTable,'table*') THEN
DROP TABLE $(vTable);
END IF
NEXT
Ok, thanks a lot