Archives of the TeradataForum
Message Posted: Sat, 20 Dec 2003 @ 14:37:41 GMT
Subj: | | Re: Suggestions for checking whether table exists or not |
|
From: | | Meade, Cornelius |
This is not exactly what you were asking for but it illustrates how you can do the type of thing you are asking about in a BTEQ script
file. Instead of doing a "DROP TABLE" command to could use something less destructive/innocuous that would determine if the table in
question existed (such as a SELECT COUNT(*) FROM TABLE_NAME or something else that would be quick to execute depending on your
environment)....
--
DROP TABLE TABLE_NAME ;
.IF ERRORCODE=3807 THEN .GOTO CONTINUE
.IF ERRORCODE>4 THEN .GOTO ERRORS
.LABEL CONTINUE
CREATE TABLE TABLE_NAME ....
.IF ERRORCODE>4 THEN .GOTO ERRSEV
.QUIT 0
.LABEL ERRORS
.QUIT ERRORCODE
|