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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AartiPosted Dec 10, 2013, 2:27 AM
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.
Jignesh TrivediPosted Oct 18, 2013, 2:14 AM
Ravi ShekharPosted Oct 18, 2013, 12:59 AM
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?
Veena SardaPosted Oct 18, 2013, 12:30 AM
Jignesh TrivediPosted Oct 18, 2013, 12:28 AM
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.
Posted Oct 18, 2013, 12:10 AM
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.