Solved

I need help creating a Stored Procedure that calls a view using SQL Server 2012

Posted on 2016-09-07
3
59 Views
Last Modified: 2016-09-19
Hi Experts,
I need help creating a Stored Procedure that calls a view using SQL Server 2012.  Is this possible?  What's the syntax for this?

Thanks in advance,
mrotor
0
Comment
Question by:mainrotor
3 Comments
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 41787951
A SQL View is like a table so for sure you can do that as in your SP code you will just have statement like


SELECT col1,col2,etc...
FROM YourViewNameHere
WHERE....

For security considerations the user running that SP must (obviously) have SELECT rights from all the view underlying tables.
1
 
LVL 47

Expert Comment

by:Vitor Montalvão
ID: 41789245
Totally agree with Icohan. A view isn't more than a virtual table so there's no difference on the way you're using both.
0
 

Author Comment

by:mainrotor
ID: 41805198
Thanks. It works just fine.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Slow Connectivity over ODBC 8 35
sql 2014,  lock limit 5 32
MS SQL + Insert Into Table - If Doesnt Exist 9 35
How to use three values with DATEDIFF 3 23
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question