Information générale
Forum:
Microsoft SQL Server
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement