Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: SQL failing
Date: Jul 14 2003 6:20PM

On Mon, 2003-07-14 at 17:12, Sabherwal, Balvinder (MBS) wrote:
> I have a script which connects to the Sybase database and create a work
> table and has a check to see if the tables exists, drop it. The drop
> statement is as below
> $tblchk="if object_id(\"dbo.LatencyArch_staging\") is not null
> begin
>     drop table $opt_D\.\.$tbl
> end
> ";
> For some reason, the SQL gets executed and its not dropping the table. If I
> print $tblchk from the debug mode and execute the generated sql from isql,
> it works fine. What am I missing??

I don't know - I assume that $opt_D and $tbl are correct, and that $tbl
is LatencyArch_staging.

I would put a PRINT statement in the begin/end block to make sure that
that part of the SQL block is actually executed.

Michael Peppler                              Data Migrations, Inc.       
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions -