Topic: SQLExecute()

In a  string type column, I need to make a SQL consult with SQLExecute() and to found the max value integer in the string  type column. I have wrote the follow code:

UltimoNumero := SQLExecute( 'SELECT MAX( IntToStr( Autores.NumDocumentoAutor ) ) FROM Autores WHERE Autores.id_TipoDocumentos LIKE ' + IntToStr(Id_TipoDocumento ) );

When I run it appear an error in the first function IntToStr() however not in the second function IntToStr().
Help please.

Post's attachments

Attachment icon errorSQLExecuteo.png 11.58 kb, 216 downloads since 2017-09-12 

Re: SQLExecute()

In SQL there is no IntToStr and StrToInt functions
Check it out

 UltimoNumero := SQLExecute( 'SELECT MAX(CAST(Autores.NumDocumentoAutor AS Int)) FROM Autores WHERE Autores.id_TipoDocumentos = ' + IntToStr(Id_TipoDocumento ) );
Dmitry.

Re: SQLExecute()

Thank you very much