[dba-SQLServer] Using the results of a stored procedure in a select query

Stoker, Kenneth E Kenneth.Stoker at pnl.gov
Tue Nov 11 16:49:45 CST 2003


Everyone,

Is it possible to include the result set of a stored procedure within a
select query?

I am trying to get a user's or role's permissions on tables and columns
within my database.  Getting the table level permissions is not problem,
but the following statement only shows table level permissions.  When
there are column level permissions only, it shows a 0.  

select sp.id, so.name, su.uid, su.name, sp.actadd, sr.name, '' as
ColumnName
from sysobjects so inner join syspermissions sp on so.id = sp.id inner
join sysmembers sm on 
	sp.grantee = sm.groupuid inner join sysusers su on su.uid =
sm.memberuid inner join
	sysusers sr on sp.grantee = sr.uid 
order by sr.name

So, I found that I can get the additional column level information I am
looking for from sp_helprotect, but I only want to include a ColumnName,
as shown at the end of the Select portion of the statement above, from
this sproc.  Does anyone have any ideas for merging the two sets of
data.

Thanks for all your help.

Ken Stoker
Technology Commercialization
Information Systems Administrator
PH: (509) 375-3758
FAX: (509) 375-6731
E-mail:  Kenneth.Stoker at pnl.gov 



More information about the dba-SQLServer mailing list