View Vs. Stored Procedure

Differences :

  1. View does not accepts parameters while SP takes parameters.
  2. View contain only one single query while SP contain several statements like conditional , loop etc.
  3. Can not perform modification in any table (DDL Statement) while SP can do this.
  4. View is nothing but an imaginary table. It contains data at run time only not created in the database where as stored procedure can be used to store business logic.It is created at database level.Main difference is stored procedure exits in database where as view does not exits in database.

Trigger Vs. Stored Procedure

Differences:

  1. Actually trigger in action which is performed automatically before or after a event occur and stored procedure is a procedure which is executed when the it is called. Stored procedure is module.
  2. SP can pass the parameters which is not a case with Triggers.
  3. While creating a Trigger triggering event and action has to be specified which isn’t a case with SP.
  4. A Trigger can call the specific SP in it but the reverse is not true.

Stored Procedures Vs. Functions

In many instances you can accomplish the same task using either a stored procedure or a function. Both functions and stored procedures can be custom defined and part of any application.

Differences :

  1. Functions, are designed to send their output to a query or T-SQL statement. For example, User Defined Functions (UDFs) can run an executable file from SQL SELECT or an action query, while Stored Procedures (SPROC) use EXECUTE or EXEC to run.
  2. A UDF returns table variables, while a SPROC can’t return a table variable although it can create a table.
  3. Another significant difference between them is that UDFs can’t change the server environment or your operating system environment, while a SPROC can.
  4. There’s quite a bit of debate about the performance benefits of UDFs Vs. SPROCs. You might be tempted to believe that stored procedures add more overhead to your server than a UDF.