Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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;

x+1,x
2,1

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

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

Error constant  SQLE_ALIAS_NOT_YET_DEFINED
ODBC 2 state    37000
ODBC 3 state    ERROR
Parameter 1 Name of the alias.
Severity    15
SQLCODE         -831
SQLSTATE    42W61
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
32.5k5417261050
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
866722
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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×93

question asked: 19 Jul '12, 08:50

question was seen: 2,152 times

last updated: 19 Jul '12, 17:32