Quantcast
Channel: SCN : Discussion List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 685

if exists not evaluated correctly

$
0
0

Sybase version

Adaptive Server Enterprise/15.0.3/EBF 17690 ESD#1.1 RELSE/P/Solaris AMD64/OS 5.10/ase1503/2681/64-bit/FBO/Thu Aug 20 15:37:40 2009

 

Good afternoon,

 

I have a question regarding my SQL code below

 

if exists (select name from tempdb..sysobjects where name = 'SSt_stats_purge')

    print 'table exists'

else

    create table tempdb..SSt_stats_purge(scan_date datetime, value int)

 

The first time I execute it, it creates my table SSt_stats_purge.

 

The second time I execute, I expect it won't create it but I have an error saying

 

Msg 2714, Level 16, State 1

Server 'HP249SRV1', Line 16

There is already an object named 'SSt_stats_purge' in the database.

 

What's wrong with my code?

 

Thanks all for your advices


Viewing all articles
Browse latest Browse all 685

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>