Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if table exists functionality

Status
Not open for further replies.

oxenberg

Programmer
Jul 1, 2002
28
0
0
US
Hi,

I need to modify a script such that if a table exists I drop it and recreate it and if it doesn't exist I just create it. How do I do this? I've searched the help but I'm still stuck. Thanks

Phil
 
if you are using sqlbase, take a look in the table SYSTABLES. there you can find all existing tables of the databse..
 
You can implement a stored procedure on the splbase which contains the functionality to drop a table or receatea table. To decide wether drop or create you can have a look into the syscatalog ( sysadm.systables ).
Now it's very simple to execute the procedure with table name and DDL script as parameter.

Oliver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top