Anil said:
Hello,
Surprised by comments, the reasons of using stored procedure is
because they are stored as compiled form in sql server. looks simple,
but imagine how much time in your life you spent for the compilation
of a program will make some sense.
Untrue, stored procedures aren't stored in compiled form, they're
re-compiled every time IF there's no execution plan in the cache,
EXACTLY the same as when I send SELECT * FROM Customer WHERE CustomerID
= @ID to the server. If I send that query AGAIN, it's also not compiled
again, the execution plan is then reused. See BOL about execution plans
and caching.
As well as SP execute in parellel
by SQL server, means if a multithreading app or many app ask for
different SP then they executed in parelled rather than sequential.
A SP isn't something special. the query inside a proc can also be send
to it through an external program and it's executed exactly the same.
More importantly also the sql server keep those proc, (frequently
used) in its cache, so that even loading of SP from HardDisk is
escaped.
till it's kicked out of the cache (execution plan that is), or a
recompile is necessary because you needed an IF statement because you
can't have flexible where clauses in the proc based on a broad range of
variables in your main app.
plus plus many more reason, as alredy mentioned etc.
yeah yeah. You can jump up and down all you want to keep the myth
alive, that doesn't make it true, Anil
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website:
http://www.llblgen.com
My .NET blog:
http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------