June 19, 2003 at 9:36 am
How does SQl Server handle prepared statements? Is it more efficient that ad hoc SQl queries if the app uses RDO?
June 19, 2003 at 9:56 am
Extract from MSDN on RDO Queries
If the SQL query you need to execute includes one or more parameters in the WHERE clause, you can use the rdoQuery object to run it and manage the parameters for each execution. This technique is especially useful when executing queries that are run repeatedly or against a number of connections — and especially when executing parameterized stored procedures.
If you execute the same query multiple times on the first run SQL Server will compile an execution plan prior to running and then cache it. If you re-run the query then SQL Server can use the cached plan = faster execution.
The ultimate and preferred method in my opinion is to encaplsulate your query in a Stored Procedure, SQL Server will compile it at design time and every call from your application including the first should then run better than an ad hoc query.
Also easier to maintain cos you can tweak the query in the Stored Procedure without needing to recompile your application
I have found it is possible to please all of the people all of the time if you do exactly what they want. Harold Macmillan 1961
I have found it is possible to please all of the people all of the time if you do exactly what they want. Harold Macmillan 1961
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply