2353096 - ASE ignores IF clause around CREATE, ALTER, or DROP | SAP Knowledge Base Article

SAP Knowledge Base Article - Preview

2353096 - ASE ignores IF clause around CREATE, ALTER, or DROP

Symptom

  • SQL contains an IF clause that conditionally executes a Data Definition Language (DDL) command (CREATE, ALTER, or DROP)
  • ASE raises an error as if it executed the DDL command even though the IF clause was not true

Example:

if not exists (select 1 from sysobjects
                  where name = "mytable")
begin
                  create table mytable (c1 int)
end
Msg 2714, Level 16, State 1:
Server 'SYBASE', Line 3:
There is already an object named 'mytable' in the database.

 if not exists (select 1 from syscolumns
               where name = "c1"
               and id = object_id("mytable"))
begin
              alter table mytable add c1 int
end
Msg 2705, Level 16, State 3:
Server 'SYBASE', Line 5:
Column names in each table must be unique. Column name 'c1' in table 'mytable'
is specified more than once.


Read more...

Environment

  • SAP Adaptive Server Enterprise (ASE) all versions
  • SAP Adaptive Server Enterprise Cluster Edition (ASE CE) all versions

 

Product

SAP Adaptive Server Enterprise 12.5 ; SAP Adaptive Server Enterprise 15.7 ; SAP Adaptive Server Enterprise 15.7 Cluster Edition ; SAP Adaptive Server Enterprise 16.0 ; Sybase Adaptive Server Enterprise 12.5 ; Sybase Adaptive Server Enterprise 15.0 ; Sybase Adaptive Server Enterprise 15.5 ; Sybase Adaptive Server Enterprise Cluster Edition 15.0 ; Sybase Adaptive Server Enterprise Cluster Edition 15.5 ; Sybase Adaptive Server Enterprise Cluster Edition 15.7

Keywords

sybase , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , BC-SYB-ASE-CE , ASE Cluster Edition (Standalone) , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP ONE Support launchpad (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.