Using SQL Server 2000, is there a way to search for a pattern globally in all trigger procedures?
Where a stored procedure is being called is hiding from me.
This is my first post so be kind.
The quick and simple way to monitor the stored procedures execution is setting up a Trace with SQL Server Profiler. This is probably good for a quick check when a user runs a process in Test and you want to capture what is he/she running.
Stored procedure in Oracle Oracle's database language, PL/SQL, is made up of stored procedures, which build applications within Oracle's database. IT professionals use stored programs in Oracle's database to properly write and test code, and those programs become stored procedures once compiled.
In Object Explorer, connect to an instance of the SQL Server Database Engine, expand that instance, and then expand Databases. Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure.
This will search triggers, procedures, functions and views on SQL Server 2000 (recommend against this approach on newer versions; see this blog post for a much better way):
SELECT o.name
FROM syscomments AS c
INNER JOIN sysobjects AS o
ON c.id = o.id
WHERE c.text LIKE '%procedurename%';
Some danger here, of course:
syscomments
will take procedures > 4000 rows and split them up into multiple rows. So there is a slight chance that a large procedure might only mention your search string on a boundary point, and not turn up at all. There is also a chance that such a procedure might show up in the list twice (you can add a GROUP BY
to eliminate that).GetAuthorSubscriptions
and you're looking for %GetAuthors%
, it will still show up. Using a case-sensitive search with a COLLATE
clause may help, but not necessarily eliminate it.More information here:
<text>
?I highly recommend moving off of SQL Server 2000. If not for the 8 billion other benefits, this task is much easier in more modern versions.
Note that your stored procedure might not be getting called from within the database - it could be an ad hoc call from an app, someone's open copy of Management Studio, or even a job. To search jobs you can use:
SELECT
job_name = j.name,
s.step_name
FROM msdb.dbo.sysjobs AS j
INNER JOIN msdb.dbo.sysjobsteps AS s
ON j.job_id = s.job_id
WHERE s.command LIKE '%procedurename%';
Still hasn't turned it up? Run a server-side trace filtering on TextData LIKE '%procedurename%'
...
Using SQL Server 2017 Using SQL Server Management Studio
To view the dependencies of a procedure in Object Explorer
Using Transact-SQL
you can follow the steps here
for more info check the original article at
https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/view-the-dependencies-of-a-stored-procedure?view=sql-server-2017
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With