Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL query
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01606642
Message ID:
01606651
Vues:
48
>>>>>The following commands in a VFP program should delete from an sql database all records for the appropriate accountno but nothing happens
>>>>>
>>>>>
>>>>> lcsqlcommand ="delete JobList where TRIM(accountno)=DG34214"
>>>>> lnresult = SQLEXEC(gnConnHandle,lcsqlcommand)
>>>>> select sqlresult
>>>>>
>>>>>What have I done wrong?
>>>>
>>>>For starts Colin if you ran that command in SQL it would not work. You need quotes round the string.
>>>>
>>>>"delete JobList where TRIM(accountno)='DG34214'"
>>>
>>>If I put quotes around the string I get a compile error
>>
>>BTW, why do you use TRIM function? Are you saving your data with spaces at the beginning of the string? Using TRIM function will not allow SQL Server to take advantage of the index if you have it for the accountNo column.
>
>I do not have spaces at the beginning only at the end - if I take out trim and run it it runs OK but I don't get any deletes

How the AccountNo column is defined? Trailing spaces should not matter in SQL Server even for char column (not to mention varchar).
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