Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

Since this query works in 7.0.3, 8.0.3, 11.0.1 and 12.0.1 (and I am sure many other versions)...

SELECT x + 1, 1 AS x;


...what is the meaning of this 12.0.1 Help topic?

Definition for alias '%1' must appear before its first reference

ODBC 2 state    37000
ODBC 3 state    ERROR
Parameter 1 Name of the alias.
Severity    15
SQLCODE         -831
Sybase error code   13837

An expression contains a reference to an alias, but the alias is defined later in the SELECT list. The alias definition must appear before its first reference.

Historical footnote...

What's New in SQL Anywhere Studio

6. What's New in Version 7.0.2

Behavior changes in version 7.0.2

Aliases must be defined before first reference

In earlier versions of SQL Anywhere, it was possible to refer to an alias in a SELECT list before the definition of the alias had appeared. An attempt to do so will now generate the error "Definition for alias alias-name must appear before its first reference". To prevent this error, the SELECT list must be re-ordered so that the alias definition appears before its first use.

asked 19 Jul '12, 08:50

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

Thanks for pointing out this issue. The error is no longer valid since ~2001. The documentation will be fixed.

permanent link

answered 19 Jul '12, 17:32

Nica%20_SAP's gravatar image

Nica _SAP
accept rate: 3%

edited 19 Jul '12, 17:32

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 19 Jul '12, 08:50

question was seen: 2,224 times

last updated: 19 Jul '12, 17:32