Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use sql % syntax
Message
 
 
À
13/10/2009 10:26:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01429124
Message ID:
01429140
Vues:
53
>>>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform