Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-09-07
3
Medium Priority
?
71 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 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 52

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

715 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