<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'SSIS', '2012', and 'SQL Server'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=SSIS,2012,SQL+Server&amp;orTags=0</link><description>Search results matching tags 'SSIS', '2012', and 'SQL Server'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Execute a SSIS package in Sync or Async mode from SQL Server 2012</title><link>http://sqlblog.com/blogs/davide_mauri/archive/2011/11/24/execute-a-ssis-package-in-sync-or-async-mode-from-sql-server-2012.aspx</link><pubDate>Thu, 24 Nov 2011 16:45:53 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:39975</guid><dc:creator>manowar</dc:creator><description>&lt;p&gt;Today I had to schedule a package stored in the shiny new SSIS Catalog store that can be enabled with SQL Server 2012. (&lt;a title="http://msdn.microsoft.com/en-us/library/hh479588(v=SQL.110).aspx" href="http://msdn.microsoft.com/en-us/library/hh479588(v=SQL.110).aspx"&gt;http://msdn.microsoft.com/en-us/library/hh479588(v=SQL.110).aspx&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;Once your packages are stored here, they will be executed using the new stored procedures created for this purpose. This is the script that will get executed if you try to execute your packages right from management studio or through a SQL Server Agent job, will be similar to the following:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Declare @execution_id bigint      &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;EXEC [SSISDB].[catalog].[create_execution] @package_name='my_package.dtsx', @execution_id=@execution_id OUTPUT, @folder_name=N'BI', @project_name=N'DWH', @use32bitruntime=False, @reference_id=Null      &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Select @execution_id      &lt;br /&gt;DECLARE @var0 smallint = 1       &lt;br /&gt;EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id,&amp;#160; @object_type=50, @parameter_name=N'LOGGING_LEVEL', @parameter_value=@var0       &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;DECLARE @var1 bit = 0      &lt;br /&gt;EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id,&amp;#160; @object_type=50, @parameter_name=N'DUMP_ON_ERROR', @parameter_value=@var1       &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;EXEC [SSISDB].[catalog].[start_execution] @execution_id      &lt;br /&gt;GO&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The problem here is that the procedure will simply start the execution of the package and will return as soon as the package as been &lt;em&gt;started…&lt;/em&gt;thus giving you the opportunity to execute packages asynchrously from your T-SQL code. This is just *great*, but what happens if I what to execute a package and WAIT for it to finish (and thus having a synchronous execution of it)? &lt;/p&gt;  &lt;p&gt;You have to be sure that you add the “SYNCHRONIZED” parameter to the package execution. Before the &lt;em&gt;start_execution &lt;/em&gt;procedure:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;exec [SSISDB].[catalog].[set_execution_parameter_value] @execution_id,&amp;#160; @object_type=50, @parameter_name=N'SYNCHRONIZED', @parameter_value=1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;And that’s it &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sqlblog.com/blogs/davide_mauri/wlEmoticon-smile_096E8EBA.png" /&gt;.&lt;/p&gt;  &lt;p&gt;PS&lt;/p&gt;  &lt;p&gt;From the RC0, the SYNCHRONIZED parameter is automatically added each time you schedule a package execution through the SQL Server Agent. If you’re using an external scheduler, just keep this post in mind &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sqlblog.com/blogs/davide_mauri/wlEmoticon-smile_096E8EBA.png" /&gt;.&lt;/p&gt;</description></item></channel></rss>