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

Billy Pang tuxedo_man at hotmail.com
Tue Nov 11 17:09:11 CST 2003


You can store the results of the stored procedure in a temporary table and 
then join it to your SELECT query...

see below for example..

HTH

Billy

--- cut here ---
create table #myTempResults(
Owner VARCHAR(255),
Object VARCHAR(255),
Grantee VARCHAR(255),
Grantor VARCHAR(255),
ProtectType VARCHAR(255),
[Action] VARCHAR(255),
[Column]  VARCHAR(255));

INSERT INTO #myTempResults exec sp_helprotect

DROP TABLE #myTempResults;
--- cut here ---


>From: "Stoker, Kenneth E" <Kenneth.Stoker at pnl.gov>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: dba-SQLServer at databaseadvisors.com
>Subject: [dba-SQLServer]Using the results of a stored procedure in a select 
>query
>Date: Tue, 11 Nov 2003 14:49:45 -0800
>
>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
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*   
http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca



More information about the dba-SQLServer mailing list