Tuesday, January 12, 2016

Find Text from SP or JOB

USE [msdb]
GO
SELECT j.job_id,
 s.srvname,
 j.name,
 js.step_id,
 js.command,
 j.enabled
FROM dbo.sysjobs j
JOIN dbo.sysjobsteps js
 ON js.job_id = j.job_id
JOIN master.dbo.sysservers s
 ON s.srvid = j.originating_server_id
WHERE js.command LIKE N'%SP text %'
--and js.command not like '%sp_send_dbmail%'

select  *
from syscomments
where text like '%abc%'
order by object_name(id)

No comments:

Post a Comment

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...