Solved

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

Posted on 2016-09-07
3
46 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
Comment Utility
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 45

Expert Comment

by:Vitor Montalvão
Comment Utility
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
Comment Utility
Thanks. It works just fine.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MS SQL Backup 24 69
sqlseverexpress 2008 agent xps question 1 11
Numeric sequence in SQL 14 36
Retention Policy for Backups 1 12
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now