walter01
20th February 2004, 11:26
Hi everyone,

I'm writing a script that drops en re-creates a list of tables.
When I try to db.drop a table that doesn't exist, I get the Error 506 BW message window and the script stops. How can I make the script check the existance of the table before dropping it ?
Checking the return value of for example db.first doesn't work sinds the script stops with error 506 before I can process any return values.
Any sugestions ?

Walter

zardoz
20th February 2004, 12:03
You can try to do the db.create.table first and check the return code. If the return code is <> 0 then you can do the db.drop.table and the db.create.table again.

walter01
20th February 2004, 12:06
Due to time limitations (our course data has to be reinstalled before the next class) the script has to be very fast and I thought that using db.create just to check the table would decrease the performance of the script.

Walter

customizer
20th February 2004, 12:24
Hello,

you might try and set the predefined variable "error.bypass" to 1 before calling db.drop.table. Then your program will not be terminated by any database error.

Just be sure to check the "e" variable afterwards to see if any other error than 506 has occurred.

Greetz

walter01
20th February 2004, 14:05
Thanks a lot !

The error.bypass mechanism works great !

regards,

Walter