RE: sql syntax
Posted in 2000
Two ways of doing it ...
# the polite way
#note quotes here, and someTable is lowercase - not miXed or UPPER
SELECT count(*) INTO n
FROM systables
WHERE tabname = "someTable"
IF n THEN
DROP someTable
END IF
....
or
# the imperative way
# just drop the table - if it's not there keep going
WHENEVER ERROR continue
DROP someTable
# you 'ought' to check your error state here
WHENEVER ERROR stop # or use you error handler
....
-----Original Message-----
From: Frankie [mailto:kehunchi@cm1.hinet.net]
Sent: 15 November 2000 08:24
To: informix-list@iiug.org
Subject: sql syntax
Hello everybody:
I want to check if a table exist in a database,what sql syntax can I
write?
Now my requirement is follow:(my DB is informix 7.3)
If (table exist) then
drop table
create table
...
Thank's everybody.
--
Frankie Ke
Colovos Machinery Corp
TEL:(04)4070810*203 FAX:(04)-4071129
Email:kehunchi@cm1.hinet.net