• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 79
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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