ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Umair Khan , Web Developer , Innovative Designers
تاريخ النشر: 2017/03/29
Mouhamed Saleem Al-Zayat
من قبل 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
من قبل 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
من قبل 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
من قبل Amrahmed Ragheb , Senior Product Specialist , Techno – Q

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

Pushpak Dutta Dwary
من قبل 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
من قبل 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
من قبل 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
من قبل Mohamed Awad Idres Osman , Software Developer , University of Science and Technology

1. reduce time and effor.

2. minimize the code.

Lerato Stofile
من قبل Lerato Stofile , SQL & MI Reporting Analyst , Stanlib

In order to reuse the code

Thawqeer Husain Mirza
من قبل Thawqeer Husain Mirza , Software Developer , JASP Information Solutions

1. To reuse a block of code.

2. Minimize coding complexity

ravindra ghatage
من قبل ravindra ghatage , Oracle & DB2 DBA , Wipro Infotech

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

المزيد من الأسئلة المماثلة