Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Why use stored procedures? Why developer put his time and effort in creating and using stored procedures?

user-image
Question added by Umair Khan , Web Developer , Innovative Designers
Date Posted: 2017/03/29
Mouhamed Saleem Al-Zayat
by Mouhamed Saleem Al-Zayat , Resident Software Engineer , Crystal Networks

Procedures are a great tool to build & maintain objects  & data in database ,select complex query, apply data business roles. it gives you the ability to control in database like programming language (using the conditions and iterators), and gives you accessing to SQL Server ready functions & proceders.

FAISAL AMMANOOR MOHAMEDALI
by FAISAL AMMANOOR MOHAMEDALI , IT Engineer , Higher Colleges of Technology

Reduces the load on the client end so basic spec device is enough in the client end

Less network usage 

Siddharth Chauhan
by Siddharth Chauhan , Analyst , NIIT Technologies Pvt. Ltd

Stored Procedures is a fundamental programming structure in relational database system like MS SQL Server and provides many advantages like:

Performance - SPs are precompiled code and hence several stages of query execution are already done and save time. Reduce network traffic as we have to do a single line code call for a SP which may contain thousands of code lines. SPs also has ability to re-use optimized cached plans.

Security - SPs encapsulate code and hence hides backend list of objects from end application. SPs can also be stored in encrypted format to hide proprietary code from end users and administrators.

Amrahmed Ragheb
by Amrahmed Ragheb , Senior Product Specialist , Techno – Q

Reduced server/client network traffic, Stronger security,Reuse of code, Easier maintenance, Improved performance

Pushpak Dutta Dwary
by Pushpak Dutta Dwary , MS SQL Database Administrator , IBM India pvt. Ltd

Stored procedures provide improved performance because fewer calls need to be sent to the database. For example, if a stored procedure has four SQL statements in the code, then there only needs to be a single call to the database instead of four calls for each individual SQL statement.

First, SQL Server has already parsed, optimized, and compiled stored procedures, so they run quickly without needing to repeat these steps each time. Also, stored procedures run on the SQL Server, using the power of the server and reducing the load on the client (which might be a much less powerful computer). Finally, using stored procedures reduces network traffic. Instead of the SQL Server sending all the data to the client and having the client run a query, the client sends a request to the server to run the procedure. The server returns only the result data set, which is usually a lot smaller than the full data set.

Once a stored procedure has run, it remains in memory, so the next user can run it without incurring the overhead of loading it into memory.

We can use stored procedures to enforce a level of consistency in your client applications. If all the client applications use the same stored procedures to update the database, the code base is smaller and easier to maintain, and you run less risk of deadlocks because everyone is updating tables in the same order.

Stored procedures enhance security, too, because you can give the users only EXECUTE permission on the stored procedures, while restricting access to the tables and not allowing the users any direct update privileges. When other users run a stored procedure, they run it as if they had the permissions of the user who created the query.

 

 

Mohammad Bin Qasim Niaz
by Mohammad Bin Qasim Niaz , Dot Net Architect , Zensar Technologies Limited

Stored procedures provide improved performance because fewer calls need to be sent to the database. For example, if a stored procedure has four SQL statements in the code, then there only needs to be a single call to the database instead of four calls for each individual SQL statement.

The benefits of using stored procedures in SQL Server rather than application code stored locally on client computers include:
  1. They allow modular programming.
  2. They allow faster execution.
  3. They can reduce network traffic.
  4. They can be used as a security mechanism.

shishir  kant
by shishir kant , Oracle Apps Technical Consultant , Experis

1) It provide layer of security.

2) Easily maintain and reusable.

3) Improve performance

Mohamed Awad Idres Osman
by Mohamed Awad Idres Osman , Software Developer , University of Science and Technology

1. reduce time and effor.

2. minimize the code.

Lerato Stofile
by Lerato Stofile , SQL & MI Reporting Analyst , Stanlib

In order to reuse the code

Thawqeer Husain Mirza
by Thawqeer Husain Mirza , Software Developer , JASP Information Solutions

1. To reuse a block of code.

2. Minimize coding complexity

ravindra ghatage
by ravindra ghatage , Oracle & DB2 DBA , Wipro Infotech

Store procedure having bunch of code.. It will be reusable... aslo its works faster than normal query.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.