error - object already exists in database

"Alan Humphrey" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <000201c575d5$446cec00$6400a8c0@Gilgamesh>
I'm trying to create tables via my Perl script, working against a remote
database.  The error returned is:

 

DBD::Sybase::db do failed: Server message number=2714 severity=16 state=6
line=1 server=GILGAMESH\BIRDWEB text=There is already an object named
'abundancies' in the database. at sql_server.pl line 74, <WORK> chunk 1.

 

The SQL being executed is:

 

CREATE TABLE  abundancies (

        bird_id integer not null,

        ecoregion_id integer not null,

        abundancy_notes text,

        january char(1),

        february char(1),

        march char(1),

        april char(1),

        may char(1),

        june char(1),

        july char(1),

        august char(1),

        september char(1),

        october char(1),

        november char(1),

        december char(1),

        PRIMARY KEY (bird_id, ecoregion_id)

)

 

The code looks like:

 

sub do_command {

            my $sql_command = shift;

            

            my $dbh = DBI->connect('DBI:Sybase:server='. $server, $user,
$pass, {RaiseError=>1, AutoCommit=>1})

              or die "Couldn't connect to database: " . DBI->errstr;

 

            $dbh->do($sql_command);

 

            $dbh->disconnect();

}

 

The reason I'm posting to this list is that if I execute the same command
from other tools (e.g. Query Analyzer) it works.

 

Any ideas?

 

- Alan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.