Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 10 Nov 2006 @ 18:28:07 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Dropping a table from sql assistant
 
From:   Stone, Randall

I'm trying to drop a table from within a query before I recreate it. The design is still in flux, thus it is easier to drop the old table and recreate it from within the query, rather than have a separate alter table statement and then changing the columns in the query as well.

Anyway, I'm using SQL Assistant, not BTEQ. When I ran some of the suggested solutions I found in the forum archives, such as:

     DROP TABLE DROP TABLE tablename ;

     .IF ERRORCODE=3807 THEN .GOTO CONTINUE

     .IF ERRORCODE>4 THEN .GOTO ERRORS

     .LABEL CONTINUE

     CREATE TABLE ...

     .IF ERRORCODE>4 THEN .GOTO ERRSEV
     .QUIT 0
     .LABEL ERRORS
     .QUIT ERRORCODE

It didn't want to work in SQL Assistant. It immediately kicked out of the query and posted the error in the history window, instead of running the GOTO statement. I'm used to using an IF EXISTS (select tablename) THEN DROP TABLE, as I normally use SQL Server.


Thanks in advance.

Randall Stone, Unisys



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023