Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performance question
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00680632
Message ID:
00686789
Vues:
51
Well, that was just for my example, If you use an ad-hoc query will it be faster if you concat the string together vs letting VFP insert the variables for you.

ex

"select * from sometable where id = '" + lcID + "'"
vs
"select * from sometable where id = ?lcID"




>When I was working on the C/S book, I noticed that if you use the parameters, VFP/ODBC generates the call to sp_executesql but if you don't, VFP/ODBC creates a batch w/o it.
>
>I'm not sure what the speed difference will be or even if there will be a difference. sp_executesql's job is to try to cache the query plan for ad-hoc queries. I see no benefit to calling a stored proc through sp_executesql.
>
>-Mike
>
>>"try sending the stored procedure with the parameters as literals in the commandstring. IOW, don't use VFP's ability to parameterize the commandstring."
>>
>>So your saying that this:
>>
>>"exec moveStudentIn '"+ lcStudentID + "', '"+ lcHall +"', "+ lcRoom +", '" + lcDate + "', "+iif(lbToSingle,'1','0')+", "+alltrim(str(piCurrentPeriod))
>>
>>is faster than this:
>>
>>"exec moveStudentIn ?lcStudentID, ?lcHall, ?lcRoom, ?lcDate, ?lbToSingle, ?piCurrentPeriod"
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform