Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a View Call a Stored Procedure? 2

Status
Not open for further replies.

checkai

Programmer
Jan 17, 2003
1,629
US
Can a View Call a Stored Procedure?

that's my only question!!

DLC
 
Can I put the entire contents of a SP into a function?

If yes, how do I create the function/call it by the view?

THanks,

DLC
 
There are certain rules for creating functions and not all stored procedures can be converted to functions. The basic syntax for creating a function can be found in SQL BOL.


Does the stored procedure return a single scalar value or a result set?

If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
I'm just curious here, why not just call the stored procedure instead of going through the added step of making it a view? Maybe if you told us more about why you are doing this we could suggest a better way to accomplish what you want.
 
We have a new system that uses queries to send out "email Alerts"

This system only recognizes TABLES and VIEWS. Doesn't recognize the SP's...so I want to use a VIEW...

The result set consists of NAME,DESCRIPTIVE STRING,SUM(HOURS)

however I have used a cursor in the SP

Dustin
 
AH now I see. OK post your stored procedure and if we can convert it from a cursor to a set-based statement, you can use that to create the view.
 
I have gotten it figured out now...with help from others...thanks a bunch!

Dustin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top