mssql server 查看作业中执行了哪些脚本

SELECT j.job_id                                      AS JOB_ID            
      ,j.name                                        AS JOB_NAME
      ,s.step_id                                     AS Step_Id          
      ,s.command                                     AS Command
      ,CASE WHEN [enabled] =1 THEN 'Enabled'
                              ELSE 'Disabled'  END   AS JOB_ENABLED       
      ,j.category_id                                 AS JOB_CATEGORY_ID
      ,c.name                                        AS JOB_CATEGORY_NAME
      ,[description]                                 AS JOB_DESCRIPTION   
      ,date_created                                  AS DATE_CREATED      
      ,date_modified                                 AS DATE_MODIFIED
FROM msdb.dbo.sysjobs j
INNER JOIN msdb.dbo.syscategories c ON j.category_id = c.category_id
INNER JOIN msdb.dbo.sysjobsteps s ON j.job_id = s.job_id
ORDER BY j.name, s.step_id
 
 
 
 
--权限
--加权限
GRANT EXEC TO dandan
GRANT ALTER TO dandan
GRANT delete TO dandan
--去除权限
REVOKE  EXEC TO dandan
REVOKE  ALTER TO dandan
REVOKE  delete TO dandan
EXEC sp_addrolemember 'db_datareader','dandan';

 

posted @ 2020-05-13 14:40  黑贝是条狗  阅读(486)  评论(0编辑  收藏  举报