• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 76
  • Last Modified:

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

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
mainrotor
Asked:
mainrotor
1 Solution
 
lcohanDatabase AnalystCommented:
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
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
mainrotorAuthor Commented:
Thanks. It works just fine.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now