Subject Insert an ORDERED SELECT
Author Alejandro Garcia
Hi! is there any restriction in InterBase 7.5 regarding the <select_expr> of an INSERT statement?
I get an error in the ORDER BY part of the <select_expr>
I've read the specifications here (they are about 6.0 version) and says nothing about the ORDER BY of the SELECT
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_download_documentation

Here's the query, if I run the SELECT part without INSERT it works fine, but when I run this query I get the error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 16, char -1.
ORDER

If I delete the ORDER BY part it also works fine and inserts it unordered

INSERT INTO TEMPORALPRUEBA1
(TEMPORALPRUEBA1.CLIENTID, TEMPORALPRUEBA1.DATE2, TEMPORALPRUEBA1.DATE1)
SELECT
TRACTAMENTS.C_HISTORIA,
TRACTAMENTS.DATA_INGRES,
TRACTAMENTS.DATA_ALTA
FROM
TRACTAMENTS
WHERE
(TRACTAMENTS.C_HISTORIA >= 5000 And TRACTAMENTS.C_HISTORIA <= 5044)
AND
((TRACTAMENTS.C_PRESTACIO = 1004 AND
TRACTAMENTS.C_MOTIU = "2" )OR
(TRACTAMENTS.C_PRESTACIO = 2014 AND
TRACTAMENTS.C_MOTIU = "8"))
ORDER BY
TRACTAMENTS.C_HISTORIA


---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

[Non-text portions of this message have been removed]