{"id":25593,"date":"2026-04-29T06:48:00","date_gmt":"2026-04-29T04:48:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=25593"},"modified":"2023-05-16T13:47:28","modified_gmt":"2023-05-16T11:47:28","slug":"create-pause-in-ssis-using-t-sql","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/ssis\/create-pause-in-ssis-using-t-sql\/","title":{"rendered":"Create a pause in an SSIS package using T-SQL"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-center\" id=\"h-create-a-break-in-an-ssis-package-with-a-t-sql-query-and-the-wait-for-delay-function\"><strong><em>Create a break in an SSIS package with a T-SQL query and the WAIT FOR DELAY function.<\/em><\/strong><\/h4>\n\n\n\n<p>The Microsoft SSIS ETL does not offer a dedicated native component to create a pause in an SSIS package. Whether it is a few seconds or a few minutes in a control flow between 2 sequences for example. To mark a pause between the execution of several SSIS tasks, SQL queries, or containers, a good alternative is to create a loop in C# code, based on time. Similarly, with the SSIS Script Task component, it is possible to use time functions to set the pause and wait for the desired time.<\/p>\n\n\n\n<p>However, a simpler solution is to use the <strong><em>Execute SQL Task<\/em><\/strong> and the <strong><em>T-SQL WAITFOR DELAY<\/em><\/strong> function. Or to schedule the time when the package should be finished executing. This page lists all the <a href=\"https:\/\/expert-only.com\/en\/ssis-tutorials\/\">tutorials for learning the basics of Microsoft SSIS<\/a>.<\/p>\n\n\n\n<p>Here is an example of a <a href=\"https:\/\/en.wiktionary.org\/wiki\/T-SQL\" target=\"_blank\" rel=\"noreferrer noopener\">Transact-SQL script<\/a> to simply add a pause of a few seconds, minutes or hours before moving on to the next component. For example, it allows you to wait for a file copy or load to finish completely. To do this, set the hours, minutes and seconds directly in the SQL code or hard-coded in an SSIS variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-1-add-and-set-up-the-ssis-components\">1. Add and set up the SSIS components<\/h2>\n\n\n\n<p>To start, <a href=\"https:\/\/expert-only.com\/lessons\/create-an-ssis-project-and-a-package-with-visual-studio-2019\/\"><strong>create an SSIS project<\/strong><\/a> with Visual Studio 2019. Then <a href=\"https:\/\/expert-only.com\/lessons\/connect-to-sql-server-using-the-ssis-connection-manager\/\"><strong>configure an OLE DB connection<\/strong><\/a> to a SQL Server database, in this case it is a local database so <em>localhost<\/em> is used as the server. Then add the following components:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A first data flow.<\/li>\n\n\n\n<li>The <em><strong>Execute SQL Task<\/strong><\/em> component between the two data streams to time the execution.<\/li>\n\n\n\n<li>The second SSIS data flow.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_ajout_execute_sql_task-1.jpg\" alt=\"Add a SQL task to create a pause  in an SSIS package\" class=\"wp-image-8102\" width=\"601\" height=\"580\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_ajout_execute_sql_task-1.jpg 601w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_ajout_execute_sql_task-1-300x290.jpg 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><figcaption class=\"wp-element-caption\"><em>Add a SQL task to create a pause in an SSIS package<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-set-up-the-ssis-execute-sql-task\">2. Set up the SSIS Execute SQL task<\/h2>\n\n\n\n<p>Configure the component with a T-SQL query to wait for the desired time, with a format of type: <strong>HH:MM:SS<\/strong>, in this order:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hours<\/li>\n\n\n\n<li>Minutes<\/li>\n\n\n\n<li>Seconds<\/li>\n<\/ul>\n\n\n\n<p>Use this sample SQL code to create a 5 second pause with a T-SQL script, i.e., no hours, no minutes, but a break of 5 seconds.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">WAITFOR DELAY '00:00:05'; \n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"591\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execute_sql_task.jpg\" alt=\"Select the database and add the SQL code to create a 5 second pause\" class=\"wp-image-8108\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execute_sql_task.jpg 673w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execute_sql_task-300x263.jpg 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><figcaption class=\"wp-element-caption\"><em>Select the database and add the SQL code to create a 5 second pause<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-run-the-ssis-package-and-observe-the-pause-time\">3. Run the SSIS package and observe the pause time<\/h2>\n\n\n\n<p>Once the pause task is linked and configured, run the SSIS package containing the data flow and observe the 5 second pause time.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"587\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execution_5_secondes_delai.jpg\" alt=\"The SSIS package pauses for 5 seconds and then proceeds to the next task\" class=\"wp-image-8117\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execution_5_secondes_delai.jpg 600w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execution_5_secondes_delai-300x294.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption class=\"wp-element-caption\">The SSIS package pauses for 5 seconds and then proceeds to the next task<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Once the pause is over, the following tasks run normally, i.e., immediately. It is also possible to manage this script also with SSIS variables for more flexibility to use a dynamic timing pause, like a predefined time store in a configuration SQL Server table.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"584\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execution_terminee.jpg\" alt=\"Successful completion of the SSIS package with a pause\" class=\"wp-image-8123\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execution_terminee.jpg 601w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/06\/ssis_pause_execution_terminee-300x292.jpg 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><figcaption class=\"wp-element-caption\"><em>Successful completion of the SSIS package with a pause<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-breaks-between-tasks-in-ssis\">Conclusion on breaks between tasks in SSIS<\/h3>\n\n\n\n<p>Using a SQL Server script is the simplest way to implement a break in an SSIS package. It does not address more complex needs such as waiting for a text file to be dropped for example. But the script can be used in a loop with precedence constraints and variables to achieve the solution.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"xuyQXJz12R\"><a href=\"https:\/\/expert-only.com\/en\/ssis\/run-ssis-package-from-command-line\/\">Run an SSIS package from the command line using the DTExec utility<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Run an SSIS package from the command line using the DTExec utility&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/ssis\/run-ssis-package-from-command-line\/embed\/#?secret=uawSs0bzHe#?secret=xuyQXJz12R\" data-secret=\"xuyQXJz12R\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-ressources-on-ssis-package-management\">Ressources on SSIS package management<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/expert-only.com\/en\/ssis\/enable-ssis-package-logging-sql-server\/\"><strong>Enable and configure SSIS package logging in SQL Server<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/ssis\/run-ssis-package-from-command-line\/\"><strong>Run an SSIS package from the Windows command line<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/ssis\/deploy-ssis-packages-with-cmd-and-dtutil\/\"><strong>Deploy SSIS packages to servers with the cmd dtutil tool<\/strong><\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Create a break in an SSIS package with a T-SQL query and the WAIT FOR DELAY function. The Microsoft SSIS ETL does not offer a dedicated native component to create a pause in an SSIS package. Whether it is <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/ssis\/create-pause-in-ssis-using-t-sql\/\" title=\"Create a pause in an SSIS package using T-SQL\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10829,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[516],"tags":[],"class_list":{"0":"post-25593","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ssis"},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/25593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=25593"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/25593\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10829"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=25593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=25593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=25593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}