Supress "item already exists" error message

I am trying to deploy a table called "employee" to different database.
I have create a reload.sql file that contans the structure for this table.

% File:  C:\reload.sql
% Usage:     isql read C:\RELOAD.SQL
% This command file reloads a database that was unloaded using "dbunload".
%CREATE TABLE "DBA"."employee"
(
     "empnum"                  char(15) NOT NULL,
     "empfirstname"            varchar(30) NOT NULL DEFAULT ' ',
     "emplastname"             varchar(30) NOT NULL,
     "address"                 varchar(50) NULL,
     "city"                 char(20) NULL,
     "stateprovcode"           char(2) NULL,
     "phonenum"                char(10) NULL,
     "ssid"                 integer NOT NULL,
     "zippcode"                char(10) NULL,
     PRIMARY KEY ("empnum", "storenum")
)
go
%%%%%%%%%%%%%%%%%       --END of Reload.sql--       %%%%%%%%%%%%%%%%%%
Now when this table doesn't exist in the database and someone executes the following command at the DOS prompt,
isql read c:\reload.sql -c "uid=dba;pwd=xyz;dbn=empdb"
This table gets created without a problem. But if this table already exists then error message that says "item 'employee' already exists"
I want to supress this error message, so that if the table already exists no errors are shown. Can someone help please? Thank you.
XxJayHindxXAsked:
Who is Participating?
 
gletiecqConnect With a Mentor Commented:
ASA is adaptive server anywhere, a small-footprint mobile database.  If you run the query "select @@version" from ISQL in an ASA database it should return a number between 5 and 8.

ASE is adaptive server enterprise, a large-scale RDBMS running on a dedicated database server.  If you run "select @@version" from ISQL in ASE, you should get a number back between 11 and 12.5.

The answer to your second question depends on the answer above.

Greg
0
 
gletiecqCommented:
If you're running ASA, you'd put the following around your code:

IF (select count(*) from sysobjects where name = 'employee' and type = 'U' ) THEN

CREATE TABLE ... (and the rest of your stuff)

END IF;

If you're running ASE, it's pretty much the same although the syntax will be a little different.  There's no END IF in ASE, I recall.

Greg
0
 
XxJayHindxXAuthor Commented:
I am very new to Sybase. Can you please tell me how do I find out whether I am running ASA, or ASE?
Also I need to say, If the table does NOT exist then create table...
Thank you for your help!
0
All Courses

From novice to tech pro — start learning today.