In web application,windows application what should prefer -
Stored procedure or Inline query (Means query written in application)
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Posted Oct 17, 2013, 8:10 PM EDT
Store procedure is better option in the case of web application, because if you pass inline query, you have to pass the whole query text to the server instead of procedure name. which will increase the data transfer.
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 17, 2013, 8:28 PM EDT
Hi,
Stored procedure is precompiled and cached so performance is much better.
Stored procedure does not always improve performance of your application. Performace is also depend on other parameter.
Please refer
http://blogs.msdn.com/b/gauravagg/archive/2007/04/27/stored-procedure-vs-sql-query.aspx
http://www.codeproject.com/Articles/414272/Stored-Procedures-DO-NOT-increase-performance
hope this will help you.
Veena SardaRank #79 · 24.5K reputationPosted Oct 17, 2013, 8:30 PM EDT
Ravi ShekharRank #673 · 3.6K reputationPosted Oct 17, 2013, 8:59 PM EDT
I am very much familiar with stored procedure.
I am searching a strong reason to use stored procedure in Web application. Actually i have to explain it to my boss. Currently I am working on windows development. My boss is not prefered for stored procedure for every process. but I often use stored procedure for every process.
If I am making stored procedure for DML operation is it not good practice?
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 17, 2013, 10:14 PM EDT
AartiRank #2,383 · 594 reputationPosted Dec 9, 2013, 9:27 PM EST
1.For any complex data work. If you're going to be doing something truly requiring a cursor or temp tables it's usually fastest to do it within SQL Server. 2.When you need to lock down access to the data. If you don't give table access to users (or role or whatever) you can be sure that the only way to interact with the data is through the SP's you create.
Why Use queries:
1.For CRUD when you don't need to restrict data access (or are doing so in another manner). 2.For simple searches. Creating SP's for a bunch of search criteria is a pain and difficult to maintain. If you can generate a reasonably fast search query use that.