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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking object references and permissions in stored procedure 1

Status
Not open for further replies.

SamGarland

Programmer
Oct 21, 2003
19
0
0
NZ
Hi all.

Does anyone know an <<easy>> way to check that at a given point in time, object references in a stored procedure can be resolved and are accessible without actually executing the stored procedure?

Sam
 
You can use the SET SHOWPLAN_TEXT statement. This is used to display the execution plan without actually executing the statement(s). If your SP references objects that don't exist, or objects that the user doesn't have permissions on, then an error will be returned.

Code:
create proc test
as

select * from NonExistentTable
go

set showplan_text on
go
exec test
go
set showplan_text off
go

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top