Supress "item already exists" error message

Posted on 2003-03-19
Medium Priority
Last Modified: 2011-04-14
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")
%%%%%%%%%%%%%%%%%       --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.
Question by:XxJayHindxX
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 8168841
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)


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.


Author Comment

ID: 8169920
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!

Accepted Solution

gletiecq earned 80 total points
ID: 8174657
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.


Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, WatchGuard's Director of Security Strategy and Research Teri Radichel, takes a look at insider threats, the risk they can pose to your organization, and the best ways to defend against them.
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question