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. Web 端屏幕适配方案

    基础知识 像素相关 1.像素 :像素是屏幕显示最小的单位. 2.设备像素 :设备像素又称物理像素(physical pixel),设备能控制显示的最小单位,我们可以把这些像素看作成显示器上一个个的点. ...

  2. c# 通过文件夹共享复制文件到服务器

    public static string[] GetFileNames(string directoryPath, string searchName) { return Directory.GetF ...

  3. Linux系统下 MYSQL数据库中的数据库文件在本机内迁移 (需暂停服务的方式)

    Linux系统下 MYSQL数据库中的数据库文件在本机内迁移 本机采用Ubuntu16.04系统,tar方式安装MySQL5.7.21 数据库安装文件夹为    /home/devil/mysql 现 ...

  4. matlab 读多个文件夹(有名字规律)中的文件名字保存到txt中

    save_file_name='C:\Users\cong\Desktop\研一实战\项目\图像中时间数字识别\OCR\result6\'; :: image_path=strcat('C:\User ...

  5. How To Enable EPEL Repository in RHEL/CentOS 7/6/5?

    What is EPEL EPEL (Extra Packages for Enterprise Linux) is open source and free community based repo ...

  6. flash exe to flv swf

    一般婚纱视频的文件都是用adobe软件转化为exe文件,所以只能用adobe flash打开,想上传到网上供朋友欣赏,却发现格式不对,那么我们可以用以下的方法将exe格式的视频转化为swf和flv等视 ...

  7. SpringBoot2.0 url中出现特殊符号「带括号{}'"等等」时会抛出400错误

    访问 http://127.0.0.1:8080/api?method=taxiong.goods.list&params={"page":1,"pageSize ...

  8. IntelliJ IDEA、JetBrains PyCharm 注册码-收藏

    IntelliJ IDEA JetBrains PyCharm 注册码 http://idea.lanyus.com/ CNEKJPQZEX-eyJsaWNlbnNlSWQiOiJDTkVLSlBRW ...

  9. Spring整合Hibernate,Druid(Maven)

    本文转载自:http://blog.csdn.net/lantazy/article/details/52495839 首先,说一下spring,spring有很好的整合能力,Web应用的各个层次都能 ...

  10. httpclient跳过https请求的验证

    一.因为在使用https发送请求的时候会涉及,验证方式.但是这种方式在使用的时候很不方便.特别是在请求外部接口的时候,所以这我写了一个跳过验证的方式.(供参考) 二.加入包,这里用的是commons- ...