Thursday, February 3, 2011

SQL:Find table exist or not

 IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'  AND TABLE_NAME='temp_Transports')    
    drop table temp_Transports   
ELSE    
        print 'tablename does not exist.'  

No comments :

Post a Comment