Consultor Eletrônico



Kbase P71581: Column not found/specified (7520) using DatePart() in an SQ
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/03/2004
Status: Unverified

SYMPTOM(s):

=== SQL Exception 1 ===
SQLState=42S22
ErrorCode=-20006
[JDBC Progress Driver]:Column not found/specified (7520)

Executing a statement similar to the following that attempts to arrange the result set by month of the date:

select InvoiceNum, CustNum, InvoiceDate from pub.invoice order by datepart(m, invoicedate);

CAUSE:

The DatePart Function is a Visual Basic Script function and is not an SQL-92 function.

FIX:

Use the SQL-92 MONTH function to order the returned result set by the MONTH part of the date:

select InvoiceNum, CustNum, InvoiceDate from pub.invoice order by MONTH(invoicedate);