Solved

How can I find all stored procedures that have a following text - User does not have access

Posted on 2008-10-22
4
179 Views
Last Modified: 2012-05-05
I am using SQL Server 2005, I need to find all procs which have the following string text in the procs

User does not have access

I am getting this message when I run a bat file, whcih calss a procs which in turn calls many other procs
Is there any way I can find this with a query
0
Comment
Question by:countrymeister
  • 3
4 Comments
 
LVL 9

Expert Comment

by:jamesgu
ID: 22779890
select * from information_schema.routines where routine_type = 'PROCEDURE' and
Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')
and routine_definition like '%User does not have access%'

0
 
LVL 1

Author Comment

by:countrymeister
ID: 22780136
It gives me foill error, my mistake, I am using sql 2000 and not 2005
Msg 208, Level 16, State 1, Line 1
Invalid object name 'information_schema.routines'.
0
 
LVL 9

Expert Comment

by:jamesgu
ID: 22780190
the statement works for sql server 2000 as well

what do you get if you run

sp_helptext <with_a_stored_proc_name_here>
0
 
LVL 9

Accepted Solution

by:
jamesgu earned 500 total points
ID: 22780262
or try this

select top 10 object_name(b.id) from sysobjects a, syscomments b where a.id = b.id and a.xtype = 'P' and b.text like '%User does not have access%'
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sql Permission 6 44
Truncate vs Delete 63 90
Analysis of table use 7 30
get most recent and second most recent date in SQL Server 24 46
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now