Labels

Wednesday, 23 December 2015

SQL Server - Difference between View and Stored Procedure

The below mentioned points are key differences between View and SP .

S.No

View

Stored Procedure

1

View doesn't accepts parameters

SP accept parameters

2



View Can be used as a building block in large query.


SP Cannot be used as  building block in large query.


3




View can contain only one single Select query.




SP Can contain several statement like if, else, loop etc


.
4




We cannot perform modification to any table
using Views.



We can perform modification to one or several tables.



5

View can be used (sometimes) as the target for
Insert, update, delete queries.
Cannot be used as the target for Insert, update, delete queries.

6       View is a stored query.                                            SP is reusable code component.

7.      Select is used to execute                                          EXEC is used to execute

No comments:

Post a Comment