Solved

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

Posted on 2008-10-22
4
208 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add different cell to otherwise similiar row 4 45
T-SQL Default value in Select? 5 38
How to count the days a record spends in a step 21 51
Procedure syntax 5 42
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 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