Azhar Azhar - 24 days ago 6
SQL Question

Query vs Stored procedure; difference between two approaches

I am developing a web page for search. I have two options to build this page


  1. To build the query on page according to parameter enter by the user and send it to server.

  2. To send parameters to stored procedure and build query there and get it executed.



I want to know that which approach I should adopt and why.

I want to know the advantages or disadvantages of both approaches.

Answer

You can take idea from following links:

Ad hoc queries vs stored procedures vs Dynamic SQL

http://www.simple-talk.com/sql/t-sql-programming/to-sp-or-not-to-sp-in-sql-server/ http://www.techrepublic.com/article/determine-when-to-use-stored-procedures-vs-sql-in-the-code/5766837