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

后端 未结 10 1959
星月不相逢
星月不相逢 2020-12-04 04:59

I am confused about a few points:

  1. What is the difference between a stored procedure and a view?

  2. When should I use stored procedures, and whe

10条回答
  •  感动是毒
    2020-12-04 05:41

    A SQL View is a virtual table, which is based on SQL SELECT query. A view references one or more existing database tables or other views. It is the snap shot of the database whereas a stored procedure is a group of Transact-SQL statements compiled into a single execution plan.

    View is simple showcasing data stored in the database tables whereas a stored procedure is a group of statements that can be executed.

    A view is faster as it displays data from the tables referenced whereas a store procedure executes sql statements.

    Check this article : View vs Stored Procedures . Exactly what you are looking for

提交回复
热议问题