Quick Answer: Why You Should Not Use Stored Procedures?

When should you use stored procedures?

Basically when you have to perform operations involving data that do not need to get out of the database.

For example, you want to update one table with data from another, it makes little sense to get the data out and then back in if you can do it all in one single shot to the db..

Why use stored procedures instead SSIS?

Second, the graphical interface lets you build large, complex and reliable transforms much more easily than hand-crafted T-SQL. And third, SSIS lets you more easily interact with additional external sources, which can be very handy for things like data cleansing.

What are the disadvantages of stored procedures?

-Disadvantages of the Stored procedure.A large number of Logical operations increase CPU usage.Difficult to Debug.Not easy to Develop and Maintain.Not designed for developing Complex or Flexible business logic.

What are the advantages to use stored procedures?

Advantages of Stored ProceduresTo help you build powerful database applications, stored procedures provide several advantages including better performance, higher productivity, ease of use, and increased scalability. … Additionally, stored procedures enable you to take advantage of the computing resources of the server.More items…

Which is better view or stored procedure?

In general, a Stored Procedure stands a good chance of being faster than a direct SQL statement because the server does all sorts of optimizations when a stored procedure is saves and executed the first time. A view is essentially a saved SQL statement.

Why do we need triggers?

Triggers help the database designer ensure certain actions, such as maintaining an audit file, are completed regardless of which program or user makes changes to the data. … The programs are called triggers since an event, such as adding a record to a table, fires their execution.

Are stored procedures more secure?

Parametrized SQL does take care of this, but technically stored procedures are still a little more secure, because the user accessing information in the table doesn’t need Read Access. It only needs to be able to execute the stored procedure. Depending on your need this may or may not come into play.

Why executing stored procedures from triggers is not a good idea?

No, you do not need cursors. When your trigger is executed, if more than one row is affected, there will be multiple rows in inserted / deleted pseudo tables too. In your case you do not read which rows are updated either, so just run the procedure. … Looping with cursors is practically never good idea in the database.

What is the difference between a stored procedure and a function?

The function must return a value but in Stored Procedure it is optional. Even a procedure can return zero or n values. Functions can have only input parameters for it whereas Procedures can have input or output parameters. Functions can be called from Procedure whereas Procedures cannot be called from a Function.