>>>>Try
>>>>
>>>>
?SQLEXEC(lnHandle,"select top 1 ac from account where ac like '%'+?mytext+'%' order by ac desc limit 1","tmp")
>>>
>>>Doesn't look right to me
>>>
>>>
>>>>Top 1 to get the only one last record matching the criteria.
>>
>>I guess you're suggesting that I should actually try it. Give me a sec. then - in any case it's better than version Tracy posted - which is opened to SQL injection attacks.
>
>Well it cannot be better if it doesn't work
I was updating my reply and then I noticed it has Limit 1 at the end - which indicates it's a MySQL syntax. We had troubles getting it to work with Rich in another similar thread recently.
I know for sure that
"select top 1 Ac from Account where ac like '%' + @Ac + '%' order by Ac DESC" works in SQL Server.
If it's not broken, fix it until it is.
My Blog