Related Tags:
SQL SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. Learn More, SQL Server Management Studio (SSMS) SQL Server Management Studio (SSMS) is a software application first launched with Microsoft SQL Server 2005 that is used for configuring, managing, and administering all components within Microsoft SQL Server. Learn More, MSSQL Microsoft SQL Server is a relational database management system, or RDBMS, that supports a wide variety of transaction processing, business intelligence and analytics applications in corporate IT environments. It's one of the three market-leading database technologies, along with Oracle Database and IBM's DB2. Learn More, SQL View Views in SQL are kind of virtual tables. A view also has rows and columns as they are in a real table in the database. We can create a view by selecting fields from one or more tables present in the database. A View can either have all the rows of a table or specific rows based on certain condition. Learn More, Stored Procedure A stored procedure is a set of Structured Query Language (SQL) statements with an assigned name, which are stored in a relational database management system as a group, so it can be reused and shared by multiple programs. Learn More,

what is the difference between view and Stored Procedure (view vs stored procedure) in sql?

Description:Need to know the difference between the two in terms of which should be used in what conditions, according to my current research similar operation can be achieved using any of them

Posted by: | Posted on: Jan 25, 2019

1 answers



Best answer to this question I found on net, which will hopefully clear your concept about the difference between the two is as follows.
A Stored Procedure:

-accepts parameters
-can NOT be used as building block in a larger query
-can contain several statements, loops, IF ELSE, etc.
-can perform modifications to one or several tables
-can NOT be used as the target of an INSERT, UPDATE or DELETE statement.

A View:

-does NOT accept parameters
-can be used as building block in a larger query
-can contain only one single SELECT query
-can NOT perform modifications to any table
-but can (sometimes) be used as the target of an INSERT, UPDATE or DELETE statement.

Replied by: | Replied on: Jan 28, 2019