{"id":752,"date":"2015-11-27T11:18:39","date_gmt":"2015-11-27T05:48:39","guid":{"rendered":"http:\/\/pramodsingla.com\/?p=752"},"modified":"2015-11-27T11:18:39","modified_gmt":"2015-11-27T05:48:39","slug":"ssis-2012-ssisdb-check-execution-status-of-ssis-package","status":"publish","type":"post","link":"https:\/\/pramodsingla.com\/?p=752","title":{"rendered":"SSIS 2012 (SSISDB)- Check execution status of SSIS Package"},"content":{"rendered":"<p style=\"text-align:justify;\"><strong>Problem Statement:\u00a0<\/strong>How to check the execution status of \u00a0a SSIS package, deployed in SSISDB, using system tables?<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<blockquote><p><strong><span style=\"color:blue;\">DECLARE<\/span>\u00a0<span style=\"color:#8000ff;\">@status<\/span>\u00a0<span style=\"color:black;\"><i>INT<\/i><\/span><span style=\"color:silver;\">=<\/span><span style=\"color:black;\">2<\/span><span style=\"color:green;\"><i>\/*Running\u00a0The\u00a0possible\u00a0values\u00a0are\u00a0created\u00a0(1), running\u00a0<\/i><\/span><\/strong><\/p>\n<p><strong><span style=\"color:green;\"><i>(2),\u00a0cancelled\u00a0(3), failed\u00a0(4),<\/i><\/span><span style=\"color:green;\"><i>\u00a0pending\u00a0(5),\u00a0ended\u00a0unexpectedly\u00a0(6),\u00a0succeeded\u00a0(7),\u00a0<\/i><\/span><\/strong><\/p>\n<p><strong><span style=\"color:green;\"><i>stopping\u00a0(8),\u00a0and\u00a0completed\u00a0(9)*\/<\/i><\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">SELECT<\/span>\u00a0<span style=\"color:silver;\">*<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">FROM<\/span>\u00a0\u00a0\u00a0<span style=\"color:maroon;\">catalog<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">executions<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHERE<\/span>\u00a0\u00a0<span style=\"color:maroon;\">status<\/span>\u00a0<span style=\"color:silver;\">=<\/span>\u00a0<span style=\"color:#8000ff;\">@status<\/span><\/strong><\/p>\n<p><strong><span style=\"color:blue;\">SELECT<\/span>\u00a0e.executable_id,<span style=\"color:maroon;\">e<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">package_name<\/span><span style=\"color:silver;\">,<\/span><\/strong><br \/>\n<strong> <span style=\"color:maroon;\">e<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[executable_name]<\/span><span style=\"color:silver;\">,<\/span><\/strong><br \/>\n<strong> <span style=\"color:maroon;\">es<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[execution_path]<\/span><span style=\"color:silver;\">,<\/span><\/strong><br \/>\n<strong> <span style=\"color:maroon;\">es<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[execution_duration]<\/span><span style=\"color:silver;\">,<\/span><\/strong><br \/>\n<strong> <span style=\"color:maroon;\">[execution_result]<\/span>\u00a0<span style=\"color:silver;\">=<\/span>\u00a0<span style=\"color:blue;\">CASE<\/span>\u00a0<span style=\"color:maroon;\">es<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[execution_result]<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHEN<\/span>\u00a0<span style=\"color:black;\">0<\/span>\u00a0<span style=\"color:blue;\">THEN<\/span>\u00a0<span style=\"color:red;\">&#8216;Success&#8217;<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHEN<\/span>\u00a0<span style=\"color:black;\">1<\/span>\u00a0<span style=\"color:blue;\">THEN<\/span>\u00a0<span style=\"color:red;\">&#8216;Failure&#8217;<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHEN<\/span>\u00a0<span style=\"color:black;\">2<\/span>\u00a0<span style=\"color:blue;\">THEN<\/span>\u00a0<span style=\"color:red;\">&#8216;Completion&#8217;<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHEN<\/span>\u00a0<span style=\"color:black;\">3<\/span>\u00a0<span style=\"color:blue;\">THEN<\/span>\u00a0<span style=\"color:red;\">&#8216;Cancelled&#8217;<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">END<\/span><span style=\"color:silver;\">,<\/span><\/strong><br \/>\n<strong> <span style=\"color:maroon;\">es<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">start_time<\/span><span style=\"color:silver;\">,<\/span><\/strong><br \/>\n<strong> <span style=\"color:maroon;\">es<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">end_time<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">FROM<\/span>\u00a0\u00a0 [SSISDB].<span style=\"color:maroon;\">[catalog]<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[executables]<\/span>\u00a0<span style=\"color:maroon;\">e<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">INNER<\/span>\u00a0<span style=\"color:blue;\">JOIN<\/span> [SSISDB].<span style=\"color:maroon;\">[catalog]<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[executable_statistics]<\/span>\u00a0<span style=\"color:maroon;\">es<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">ON<\/span>\u00a0<span style=\"color:maroon;\">es<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[executable_id]<\/span>\u00a0<span style=\"color:silver;\">=<\/span>\u00a0<span style=\"color:maroon;\">e<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">[executable_id]<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHERE<\/span>\u00a0\u00a0<span style=\"color:maroon;\">e<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">execution_id<\/span>\u00a0<span style=\"color:blue;\">IN<\/span>\u00a0<span style=\"color:maroon;\">(<\/span><span style=\"color:blue;\">SELECT<\/span>\u00a0<span style=\"color:maroon;\">execution_id<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">FROM<\/span>\u00a0\u00a0\u00a0<span style=\"color:maroon;\">catalog<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">executions<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">WHERE<\/span>\u00a0\u00a0<span style=\"color:maroon;\">status<\/span>\u00a0<span style=\"color:silver;\">=<\/span>\u00a0<span style=\"color:#8000ff;\">@status<\/span><span style=\"color:maroon;\">)<\/span><\/strong><br \/>\n<strong> <span style=\"color:blue;\">ORDER<\/span>\u00a0\u00a0<span style=\"color:blue;\">BY<\/span>\u00a0<span style=\"color:maroon;\">e<\/span><span style=\"color:silver;\">.<\/span><span style=\"color:maroon;\">executable_id<\/span>\u00a0<span style=\"color:blue;\">DESC,es.start_time DESC<\/span><\/strong><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Problem Statement:\u00a0How to check the execution status of \u00a0a SSIS package, deployed in SSISDB, using system tables? Solution: DECLARE\u00a0@status\u00a0INT=2\/*Running\u00a0The\u00a0possible\u00a0values\u00a0are\u00a0created\u00a0(1), running\u00a0[&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[36],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pramodsingla.com\/index.php?rest_route=\/wp\/v2\/posts\/752"}],"collection":[{"href":"https:\/\/pramodsingla.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pramodsingla.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pramodsingla.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pramodsingla.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=752"}],"version-history":[{"count":0,"href":"https:\/\/pramodsingla.com\/index.php?rest_route=\/wp\/v2\/posts\/752\/revisions"}],"wp:attachment":[{"href":"https:\/\/pramodsingla.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pramodsingla.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pramodsingla.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}