This is bizarre, but I am hoping someone can help me out.
I have a stored procedure call which takes about 42 seconds to run – when called from an application connected by an ODBC connection. However, if I run that same call in SSMS (Sql Server Management Studio), it takes only 10 or 15 seconds to execute….as recorded by a trace.
This does not appear to be a network issue. I am only passing about 1200 records back to the client – and in any case, the times I gave you were coming straight from a trace duration field….so it is taking SQL Server 3 or 4 times longer to process the same call – when done via an ODBC call. I can reproduce this over and over again. What is more interesting, is that the reads and writes (taken from the trace) are a little higher for the ODBC call, but the CPU usage is 3 or 4 times what the SSMS call is.
There are other stored procs called as part of the same process, and they do not appear to be affected in the same way...or at least not to the same extent.
We are using SQL Server 2005
Any ideas about what is going on here?