select instance_id,jh.run_date,jh.job_id,jh.step_name,
case jh.run_status
when 0 then 'failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
end as run_status ,left(jh.run_time,len(jh.run_time)-2) as '开始时间'
,left(run_duration,len(run_duration)-2) as '分',right(run_duration,2) as '秒',jh.run_duration,jh.run_time
from msdb.dbo.sysjobhistory jh with(nolock)
where job_id=N'1C8F16AC-5C37-4D76-883F-CD318A9E19D6' and
step_name='OUT2SAP_Without_PR' and jh.run_status=1
order by instance_id desc
select * from (select instance_id,jh.run_date,jh.job_id,jh.step_name,
case jh.run_status
when 0 then 'failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
end as run_status ,left(jh.run_time,len(jh.run_time)-2) as '开始时间'
,left(run_duration,len(run_duration)-2) as '分',right(run_duration,2) as '秒',jh.run_duration,jh.run_time
from msdb.dbo.sysjobhistory jh with(nolock)
where job_id=N'1C8F16AC-5C37-4D76-883F-CD318A9E19D6' and
step_name='OUT2SAP_Without_PR' and jh.run_status=1
--order by instance_id desc union all
select instance_id,jh.run_date,jh.job_id,jh.step_name,
case jh.run_status
when 0 then 'failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
end as run_status ,left(jh.run_time,len(jh.run_time)-2) as '开始时间'
,left(run_duration,len(run_duration)-2) as '分',right(run_duration,2) as '秒',jh.run_duration,jh.run_time
from msdb.dbo.sysjobhistory jh with(nolock)
where --job_id=N'1C8F16AC-5C37-4D76-883F-CD318A9E19D6' and
step_name='AutoOut2Sap_Without_SO' and jh.run_status=1
--order by instance_id desc ) A order by instance_id desc

sqlserver job 执行时间的更多相关文章

  1. 带您理解SQLSERVER是如何执行一个查询的

    原文地址:http://www.cnblogs.com/lyhabc/p/3367274.html 看这篇文章之前,阁下可以先看一下下面的文章 SQLSERVER独特的任务调度算法"SQLO ...

  2. ClownFish:比手写代码还快的通用数据访问层

    http://www.cnblogs.com/fish-li/archive/2012/07/17/ClownFish.html 阅读目录 开始 ClownFish是什么? 比手写代码还快的执行速度 ...

  3. SQLSERVER执行时间统计工具SQLQueryStress

    有时候需要检测一下SQL语句的执行时间,相信大家都会用SET STATISTICS TIME ON开关打开SQLSERVER内置的时间统计 SET STATISTICS TIME ON 不过这款小工具 ...

  4. sqlserver 测试sql语句执行时间

    查看sql语句执行时间/测试sql语句性能 写程序的人,往往需要分析所写的SQL语句是否已经优化过了,服务器的响应时间有多快,这个时候就需要用到SQL的STATISTICS状态值来查看了. 通过设置S ...

  5. sqlserver 获取存储过程执行时间

    use [数据库名]   select last_execution_time '最近一次执行时间'  from sys.dm_exec_procedure_stats  where type='P' ...

  6. SQLServer 查看SQL语句的执行时间

    在MSSQL Server中通过查看SQL语句执行所用的时间,来衡量SQL语句的性能. 通过设置STATISTICS我们可以查看执行SQL时的系统情况.选项有PROFILE,IO ,TIME.介绍如下 ...

  7. 项目中调试SQLServer 方便的查看SQL语句的执行时间的方法

    第一种方法,先记录执行前的时间,然后在记录执行Sql后的时间,然后做减法 1 第一种方法: 2 declare @begin_date datetime 3 declare @end_date dat ...

  8. sqlserver执行时间和自行效率

    SET STATISTICS PROFILE ON --SET STATISTICS IO ON --SET STATISTICS TIME ON declare @dtm datetime SQL语 ...

  9. sqlserver检查sql执行时间

    set statistics profile onset statistics io onset statistics time onGO select * from mytable; goset s ...

随机推荐

  1. 一次SQLServer索引损坏问题的排查与修复

    线上库执行一项数据变更操作时,一直提示"出现错误 8646.请记录该错误和时间,并与您的系统管理员联系." 通过代码排查,最终确定是在执行某存储过程时触发了如下错误,并指明了位置是 ...

  2. JavaScript基本概要

    body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...

  3. linux 命令 --while

    shell while 语法: while [条件判断式] do 程序 done 对 while 循环来讲,只要条件判断式成立,循环就会一直进行,直到条件判断式不成立,循环才会停止. 例如: 循环从1 ...

  4. openfalcon源码分析之transfer

    本节内容 transfer功能 transfer接收数据来源 transfer数据去向 transfer的一致性hash transfer的一致性hash key的计算 transfer源码分析 2. ...

  5. Sizzle源码分析:一 设计思路

    一.前言 DOM选择器(Sizzle)是jQuery框架中非常重要的一部分,在H5还没有流行起来的时候,jQuery为我们提供了一个简洁,方便,高效的DOM操作模式,成为那个时代的经典.虽然现在Vue ...

  6. Location对象的页面跳转方法介绍

    JavaScript中使用location对象可以通过很多种方式改变浏览器的位置.最常用的方法应该是下面几种: demo.js 1 2 3 location.href = "http://w ...

  7. js固定表头的实现(转)

    原文链接:http://www.th7.cn/web/js/201509/121055.shtml 参考链接:http://www.jb51.net/article/102568.htm 写两个表格, ...

  8. L180

    The cylinder is a crucial part of the washing machine His debonair dismissal of my inquiry concernin ...

  9. Jmeter-Critical Section Controller(临界区控制器)

    The Critical Section Controller ensures that its children elements (samplers/controllers, etc.) will ...

  10. JavaWeb入门环境搭建

    一.安装配置Tomcat 1.下载 2.配置环境变量 配置JAVA_HOME环境变量,路径为JDK的根目录 3.测试Tomcat 打开浏览器,在地址栏输入http://localhost:8080可以 ...