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. kmp&扩展kmp

    kmp: KMP的主要目的是求B是不是A的子串,以及若是,B在A中所有出现的位置 写的很详细的大佬的博客:http://www.matrix67.com/blog/archives/115 模板: / ...

  2. iOS UILabel两端对齐的实现(可包括中英文/数字)

    - (void)conversionCharacterInterval:(NSInteger)maxInteger current:(NSString *)currentString withLabe ...

  3. 报错:Syntax error on tokens, delete these tokens

    该问题意思是说:你有两个双引号或者你有没有关闭%>符号. 仔细检查代码 出现这样的错误一般是括号.中英文字符.中英文标点.代码前面的空格,尤其是复制粘贴的代码,去掉即可.

  4. 使用jquery获取url以及jquery获取url参数的方法(转)

    使用jquery获取url以及使用jquery获取url参数是我们经常要用到的操作 1.jquery获取url很简单,代码如下 1.window.location.href; 其实只是用到了javas ...

  5. Buildroot 打包文件系统流程跟踪

    /********************************************************************************* * Buildroot 打包文件系 ...

  6. C# 根据twitter的snowflake算法生成唯一ID

    C# 版算法: using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...

  7. python 获取excel文件内sheet名称列表

    xl = pd.ExcelFile('foo.xls') xl.sheet_names # see all sheet names xl.parse(sheet_name) # read a spec ...

  8. cocos2dx字体描边

    LabelTTF::create(); 这样fontname那不填表示使用设备默认字体 std::string lvstr = FunctionUtil::getChinese("guank ...

  9. 【转】第七章、Linux 文件与目录管理

    原文网址:http://vbird.dic.ksu.edu.tw/linux_basic/0220filemanager.php 第七章.Linux 文件与目录管理 最近升级日期:2009/08/26 ...

  10. CentOS7修复python拯救yum - 转载

    原文:http://blog.51cto.com/welcomeweb/2132654 本人正在吹着空调,喝着茶水,然后qq头像抖了两下,业务开发同学给我打了个招呼,“忙么?帮个忙可以不?” 这很明显 ...