Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-10-29 : 08:47:34
|
| Kevin writes "I would like to use an inline function to return the results of a stored procedure, such as:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CREATE FUNCTION [dbo].[fnTblPrivs] () RETURNS TABLE AS EXEC sp_table_privileges 'Table1'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~so that I can reference the results conveniently in a SELECT clause.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~IF EXISTS(SELECT Grantee FROM fnTblPrivs() WHERE Grantee='myrole' AND PRIVILEGE='DELETE') print 'user has delete rights'ELSE print 'user does not have delete rights'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Am I looking for something that does not exist? Using SQL 2000 (SP2, I think).Thanks." |
|
|
M.E.
Aged Yak Warrior
539 Posts |
Posted - 2002-10-29 : 15:26:27
|
| A user defined function may not call a stored procedure. It can however call an extended stored procedure.-----------------------SQL isn't just a hobby, It's an addiction |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-10-29 : 15:28:08
|
| What about just putting the code for the stored procedure into the function itself? |
 |
|
|
|
|
|