[quoted text, click to view] >When developping an app, performance is key to me and my colleagues, so I
>would have to convince them that this way actually "performs" better. So
>how much really of a better performance do you get by using CommandType =
>StoredProc vs. "EXEC <spname>" using a CommandType = Text ? Is it just
>because CommandType = Text must parse the text in order for it to call the
>stored procedure ?
Amongst other things (from the "ADO.NET Best Practices" document by
Microsoft,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/adonetbest.asp?frame=true&hidetoc=true)
"Best Practices with SqlCommand
A quick tip for executing stored procedures using the SqlCommand: If
you are calling a stored procedure, specify a CommandType of
StoredProcedure for the CommandType property of the SqlCommand. This
removes the need to parse the command before execution, by explicitly
identifying it as a stored procedure."
Also, as mentioned by SQL Server architect Gert Drapers at TechEd
2004, using the "Execute <sproc name>" way of doing things is a so
called "Text Event", which is inherently less efficient than when
using the CommandType = StoredProc, in which case the stored proc is
called using a RPC (remote procedure call) event.
I can't quantify in terms of milliseconds or % CPU Load, but since
both a best practices document describes it, and SQL Server architects
recommend it, I guess there's a good reason why you should do it that
way! ;-)
Marc
================================================================
Marc Scheuner May The Source Be With You!