<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SSIS Archives | SQL Solutions Group</title>
	<atom:link href="https://sqlsolutionsgroup.com/tag/ssis/feed/" rel="self" type="application/rss+xml" />
	<link>https://sqlsolutionsgroup.com/tag/ssis/</link>
	<description></description>
	<lastBuildDate>Tue, 02 Aug 2022 22:30:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://sqlsolutionsgroup.com/wp-content/uploads/2021/01/cropped-SSG_FAVICON0002-32x32.png</url>
	<title>SSIS Archives | SQL Solutions Group</title>
	<link>https://sqlsolutionsgroup.com/tag/ssis/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Bringing back an informative SQL Server Agent job email notification on failed SSIS packages</title>
		<link>https://sqlsolutionsgroup.com/agent-job-email-notification/</link>
					<comments>https://sqlsolutionsgroup.com/agent-job-email-notification/#respond</comments>
		
		<dc:creator><![CDATA[Steve Rezhener]]></dc:creator>
		<pubDate>Mon, 17 Feb 2020 16:58:06 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=4576</guid>

					<description><![CDATA[<p>The post <a href="https://sqlsolutionsgroup.com/agent-job-email-notification/">Bringing back an informative SQL Server Agent job email notification on failed SSIS packages</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3><strong>Introduction</strong></h3>
<p>The SSISDB database (a.k.a. the Integration Services catalog) was introduced back in SQL Server 2012 as a way to de-clutter MSDB database and provide some built-in logging and reporting infrastructure. In a nutshell, SSISDB is an SSIS framework (see Fig #1) making SQL Server Integration Services more robust and enterprise-friendly by providing the following features:</p>
<ul>
<li>Database backup</li>
<li>Database encryption</li>
<li>Support for environments</li>
<li>Support project and package parameters</li>
<li>Package versioning</li>
<li>Custom SSRS performance reports built into SSMS</li>
<li>Support for deployment within SSDT</li>
</ul>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed2.jpg"><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-4577" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed2.jpg" alt="" width="294" height="559" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed2.jpg 294w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed2-158x300.jpg 158w" sizes="(max-width: 294px) 100vw, 294px" /></a></p>
<p>While overall SSISDB Catalog was and still is a great enhancement to SQL Server Integration Services, some previously working fine feature took a wrong turn. This blog post is going to cover the “behavioral” changes that Microsoft made to SQL Server Agent job notification as part of the SSISDB Catalog, specifically the error message reporting on failed package.</p>
<h3><strong>Problem</strong></h3>
<p>Prior to SQL Server 2012, an email notification on a failed SQL Server Agent job step with an SSIS package was really informative. The error message was specific enough, as it was providing the error from the SSIS execution engine. When Microsoft introduced SQL Server 2012, it decided to replace this specific SQL Server Agent job email notification with a generic message directing the user to the SSIS Catalog error log (see Fig #2).</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed1.jpg"><img decoding="async" class="aligncenter wp-image-4578 " src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed1.jpg" alt="SQL Server Agent job email notification" width="574" height="182" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed1.jpg 993w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed1-300x95.jpg 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed1-768x244.jpg 768w" sizes="(max-width: 574px) 100vw, 574px" /></a></p>
<p>I’m assuming when most of us are receiving Operational emails, we want to know not only if to react or not, but also how to react. This is especially important now, since we use mobile devices to read emails and might not have access to the a real computer.</p>
<p>Unfortunately, the email above gives only an indication that some SSIS package failed without giving any details. For example, in the past (prior to SQL Server 2012), you would know that your package failed due to connectivity issue by just reading an email and decide to ignore the notification. Now you don’t have that option. You would need a real computer to fire-up SSMS and run a custom SSRS on that package, adding many clicks to see the details error. Needless to say, running to your desktop/laptop to open SSMS only to discover connectivity problems is unnecessary overkill.</p>
<h3><strong>Solution: Use T-SQL to create a better SQL Server Agent job email notification </strong></h3>
<p>The solution will involve a T-SQL query (I should probably make it a stored procedure at some point) that would connect tables and records between both MSDB and SSISDB databases to bring back a detailed message on a failed SSIS package. Equipped with an email that has detailed error message, you can react without leaving your couch – fix it or just let it retry.</p>
<p>In a nutshell this solution is to going to:</p>
<ol>
<li>Find the job name based on a current SPID</li>
<li>Find a job with a failed step</li>
<li>Connect step with SSIS package name</li>
<li>Use the SSIS package name to find run-time errors in SSISDB catalog</li>
<li>Bubble us to an inner exception to include only detailed error</li>
<li>Locate a default job operator</li>
<li>Send a detailed error report</li>
</ol>
<p>The following script would need to be added as last step in a job (you can disable the job alert) with all the steps that include SSIS packages going to that last step on failure (Fig 3).</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed3.png"><img decoding="async" class="aligncenter  wp-image-4579" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed3.png" alt="" width="575" height="382" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed3.png 691w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed3-300x199.png 300w" sizes="(max-width: 575px) 100vw, 575px" /></a></p>
<p>Additionally, the used-to-be last step before Report SSIS failure was introduced that will now precede that step will need to quit the job reporting success (Fig 4) instead of continuing to the next step.<a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed4.png"><img loading="lazy" decoding="async" class="aligncenter  wp-image-4580" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed4.png" alt="" width="576" height="275" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed4.png 893w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed4-300x143.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed4-768x367.png 768w" sizes="(max-width: 576px) 100vw, 576px" />.</a></p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">DECLARE</span> @Full_ssis_command <span class="kw1">VARCHAR</span><span class="br0">&#40;</span>4000<span class="br0">&#41;</span>,
 @Job_step_id <span class="kw1">INT</span>,
 @Package_name <span class="kw1">VARCHAR</span><span class="br0">&#40;</span>4000<span class="br0">&#41;</span>,
 @EMailBody <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>2000<span class="br0">&#41;</span>,
 @EMailSubject <span class="kw1">VARCHAR</span><span class="br0">&#40;</span><span class="nu0">150</span><span class="br0">&#41;</span>,
 <span class="co1">--@Job_name VARCHAR(100),</span>
 @Job_id <span class="kw1">UNIQUEIDENTIFIER</span>
&nbsp;
<span class="kw1">SELECT</span>	@Job_id <span class="sy0">=</span> Job_id
		<span class="co1">--@Job_name = [name] --AS job_name</span>
<span class="kw1">FROM</span>	sys.<span class="me1">dm_exec_sessions</span> <span class="kw1">AS</span> ions
	<span class="kw1">INNER</span> join msdb.<span class="me1">dbo</span>.<span class="me1">sysjobs</span> <span class="kw1">AS</span> jobs <span class="kw1">ON</span> jobs.<span class="me1">job_id</span>
				<span class="sy0">=</span> <span class="kw1">CAST</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">BINARY</span><span class="br0">&#40;</span>16<span class="br0">&#41;</span>, <span class="kw2">SUBSTRING</span><span class="br0">&#40;</span>ions.<span class="br0">[</span>program_name<span class="br0">]</span>,<span class="kw2">CHARINDEX</span><span class="br0">&#40;</span><span class="st0">'(Job 0x'</span>,ions.<span class="br0">[</span>program_name<span class="br0">]</span>,1<span class="br0">&#41;</span> <span class="sy0">+</span> 5 , 34<span class="br0">&#41;</span>,1<span class="br0">&#41;</span> <span class="kw1">AS</span> <span class="kw1">UNIQUEIDENTIFIER</span><span class="br0">&#41;</span>
<span class="kw1">WHERE</span>	1<span class="sy0">=</span>1
	<span class="sy0">AND</span> ions.<span class="me1">session_id</span> <span class="sy0">=</span> <span class="kw2">@@SPID</span> <span class="co1">--63</span>
&nbsp;
<span class="co1">--print @Job_name</span>
&nbsp;
<span class="kw1">SELECT</span> <span class="kw1">TOP</span> 1 @Job_step_id <span class="sy0">=</span> Step_id
<span class="kw1">FROM</span> msdb.<span class="me1">dbo</span>.<span class="me1">sysjobhistory</span> <span class="br0">&#40;</span>NOLOCK<span class="br0">&#41;</span>
<span class="kw1">WHERE</span> Run_status <span class="sy0">&lt;&gt;</span> 1
 <span class="sy0">AND</span> Step_id <span class="sy0">&gt;</span> 0
 <span class="sy0">AND</span> Job_id <span class="sy0">=</span> @Job_id
<span class="kw1">ORDER</span> <span class="kw1">BY</span> Instance_id <span class="kw1">DESC</span>
&nbsp;
<span class="kw1">SELECT</span> @Full_ssis_command <span class="sy0">=</span> Command
<span class="kw1">FROM</span> msdb.<span class="me1">dbo</span>.<span class="me1">sysjobsteps</span> <span class="br0">&#40;</span>NOLOCK<span class="br0">&#41;</span>
<span class="kw1">WHERE</span> Job_id <span class="sy0">=</span> @Job_id
 <span class="sy0">AND</span> Step_id <span class="sy0">=</span> @Job_step_id
&nbsp;
 <span class="kw1">PRINT</span> @Full_ssis_command
&nbsp;
<span class="kw1">IF</span> @Full_ssis_command <span class="sy0">LIKE</span> <span class="st0">'%.dtsx%'</span>
 <span class="kw1">BEGIN</span>
 <span class="kw1">SELECT</span> @Package_name <span class="sy0">=</span> <span class="kw1">RIGHT</span><span class="br0">&#40;</span><span class="kw1">LEFT</span><span class="br0">&#40;</span>@Full_ssis_command,<span class="kw2">CHARINDEX</span><span class="br0">&#40;</span><span class="st0">'.dtsx'</span>, @Full_ssis_command<span class="br0">&#41;</span><span class="br0">&#41;</span>, <span class="kw2">CHARINDEX</span><span class="br0">&#40;</span><span class="st0">'<span class="es0">\'</span>, Reverse(LEFT(@Full_ssis_command, Charindex('</span>.<span class="me1">dtsx</span><span class="st0">', @Full_ssis_command)-1)))) + '</span>dtsx<span class="st0">'
 END
&nbsp;
SELECT TOP 1 @EMailBody = LEFT([Message], 2000), @EMailSubject = '</span>Package : <span class="st0">' + Package_name + '</span> failed <span class="kw1">ON</span> :<span class="st0">' + CONVERT(VARCHAR,Message_time)
--[Message_time],
-- [Extended_info_id],
-- [Package_name],
-- [Message_source_name],
-- [Subcomponent_name],
-- [Package_path],
-- [Execution_path],
-- LEFT([Message], 400)
FROM SSISDB.[catalog].[Event_messages] (NOLOCK)
WHERE [Package_name] = @Package_name
 AND Event_name = '</span>OnError<span class="st0">'
 AND Message_time &gt;= DATEADD(DD,0,DATEDIFF(DD,0,GETDATE()))
 AND Operation_id IN (SELECT Max(Operation_id)
 FROM SSISDB.[catalog].[Event_messages](NOLOCK)
 WHERE [Package_name] = @Package_name)
ORDER BY Message_time ASC
&nbsp;
DECLARE @operator_name AS VARCHAR(100) = (SELECT top 1 name from msdb.dbo.sysoperators)
PRINT @operator_name
&nbsp;
exec msdb.dbo.sp_notify_operator  @profile_name = NULL ,
    @id = NULL,
    @name = @operator_name,  
    @subject = @EMailSubject,  
    @body = @EMailBody</span></pre></div></div>
<p>Here is the improved SQL Server Agent job email notification with a detailed message that we can expect now (Fig 5).</p>
<figure class="wp-block-gallery columns-1 is-cropped">
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed5.jpg"><img loading="lazy" decoding="async" class="aligncenter wp-image-4581 " src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed5.jpg" alt="SQL Server Agent job email notification" width="575" height="118" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed5.jpg 939w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed5-300x62.jpg 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/02/jobfailed5-768x158.jpg 768w" sizes="(max-width: 575px) 100vw, 575px" /></a></p>
<h3><strong>Assumptions:</strong></h3>
<ol>
<li>DatabaseMail is enabled and functioning</li>
<li>DatabaseMail has a public and default mail profile</li>
<li>There is at least one configured Operator</li>
</ol>
<p><strong>Disclaimer</strong></p>
<p>This blog post is partially based on the following blog posts/forum discussions:</p>
<p><a href="https://www.sqlservercentral.com/forums/topic/identifying-sql-agent-job-name-based-on-the-job-id">https://www.sqlservercentral.com/forums/topic/identifying-sql-agent-job-name-based-on-the-job-id</a></p>
<p><a href="https://thebakingdba.blogspot.com/2012/11/sql-server-2012-ssis-getting-useful.html">https://thebakingdba.blogspot.com/2012/11/sql-server-2012-ssis-getting-useful.html</a></p>
</figure>


<p>The post <a href="https://sqlsolutionsgroup.com/agent-job-email-notification/">Bringing back an informative SQL Server Agent job email notification on failed SSIS packages</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/agent-job-email-notification/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to fix a failed &#8220;SSIS Server Maintenance Job&#8221; job</title>
		<link>https://sqlsolutionsgroup.com/failed-ssis-job/</link>
					<comments>https://sqlsolutionsgroup.com/failed-ssis-job/#comments</comments>
		
		<dc:creator><![CDATA[Steve Rezhener]]></dc:creator>
		<pubDate>Tue, 28 Jan 2020 04:09:00 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=4529</guid>

					<description><![CDATA[<p>The post <a href="https://sqlsolutionsgroup.com/failed-ssis-job/">How to fix a failed &#8220;SSIS Server Maintenance Job&#8221; job</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this article we will explore how to fix a failed “SSIS Server Maintenance Job”.</p>
<p><strong>Introduction</strong></p>
<p>The SSISDB database (a.k.a. the Integration Services catalog) was introduced back in SQL Server 2012 as a way to de-clutter the MSDB database and provide some built-in logging and reporting infrastructure. In a nutshell, SSISDB is an SSIS framework making SQL Server Integration Services more robust and enterprise-friendly by providing the following features:</p>
<ul>
<li>Database backup</li>
<li>Database encryption</li>
<li>Support for environments</li>
<li>Support project and package parameters</li>
<li>Package versioning</li>
<li>Custom SSRS performance reports built into SSMS</li>
<li>Deployment directly from SSDT</li>
</ul>
<p>Since SSISDB Catalog is going to log package run-time information, Microsoft created a SQL Server Agent job (SSIS Server Maintenance Job, see Fig .1) to do the in-house cleaning. This job is running two steps (see Fig 2) to enforce the data retention policy (based on SSISDB Catalog settings) instead of letting all the data collection activities to eat all your disk space and effectively brake your SSIS run-time service (if logging is enabled). </p>
<figure id="attachment_4530" aria-describedby="caption-attachment-4530" style="width: 816px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS1.png"><img loading="lazy" decoding="async" class="wp-image-4530 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS1.png" alt="failed SSIS" width="816" height="501" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS1.png 816w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS1-300x184.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS1-768x472.png 768w" sizes="(max-width: 816px) 100vw, 816px" /></a><figcaption id="caption-attachment-4530" class="wp-caption-text">Figure 1: The Job</figcaption></figure>
<p>&nbsp;</p>
<figure id="attachment_4531" aria-describedby="caption-attachment-4531" style="width: 904px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS2.png"><img loading="lazy" decoding="async" class="wp-image-4531 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS2.png" alt="" width="904" height="182" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS2.png 904w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS2-300x60.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/failedSSIS2-768x155.png 768w" sizes="(max-width: 904px) 100vw, 904px" /></a><figcaption id="caption-attachment-4531" class="wp-caption-text">Figure 2: Job Steps</figcaption></figure>
<p>While SSIS Server Operation Records Maintenance (a.k.a. step #1) is in charge of removing all the old (default=365 days) logging, SSIS Server Max Version Per Project Maintenance (a.k.a. step #2) is in change of removing all old (default=10 versions) package versioning.</p>
<p><strong>Problem</strong></p>
<p>“SSIS Server Maintenance Job” SQL Server Agent job started to fail  with the following error:</p>
<blockquote>Executed as user: #MS_SSISServerCleanupJobLogin##. A cursor with the name ‘execution_cursor’ does not exist. [SQLSTATE 34000] (Error 16916)</blockquote>
<p>This run-time error (trying to deallocate a CURSOR that doesn’t exist) happens inside Step #1 which runs a ssisdb.internal.cleanup_server_retention_window stored procedure. I’m  going to speculate and say that this bug was unintentionally introduced by adding more features (most likely, it’s the server_operation_encryption_level which was introduced with SQL Server 2012 SP2). While I first spotted this problem in SQL Server 2017 with CU12, unfortunately it’s still a problem as of December 2019 with the latest and greatest CU18 (14.0.3257.3).</p>
<p><strong>Solution</strong></p>
<p>You can wait for Microsoft to fix it in a next CU (a.k.a. Cumulative Update) or you can fix it yourself by modifying the code inside ssisdb.internal.cleanup_server_retention_window stored procedure.</p>
<p>A little warning here: You are going to be modifying the code that was created by Microsoft. You need to be comfortable with taking that risk.</p>
<p>You would need to alter the procedure by moving a DEALLOCATE statement from line #175 to #177 to fix this failed SSIS job (see Fig #3).</p>
<figure id="attachment_4532" aria-describedby="caption-attachment-4532" style="width: 675px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/FailedSSIS3.jpg"><img loading="lazy" decoding="async" class="wp-image-4532 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/FailedSSIS3.jpg" alt="" width="675" height="322" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/FailedSSIS3.jpg 675w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/FailedSSIS3-300x143.jpg 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><figcaption id="caption-attachment-4532" class="wp-caption-text">Figure 3: Solution</figcaption></figure>
<p>This post is based on <span style="text-decoration: underline;"><a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/238eb212-f757-4ce8-acea-e4c579628bd2/ssis-server-maintenance-cleanupserverretentionwindow-job-error?forum=sqlintegrationservices#dbf31af9-2bd2-4922-8b22-167453c827d9">this MSDN post</a></span>.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/failed-ssis-job/">How to fix a failed &#8220;SSIS Server Maintenance Job&#8221; job</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/failed-ssis-job/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Visual Studio 2019 SSIS Projects</title>
		<link>https://sqlsolutionsgroup.com/visual-studio-2019-ssis-projects/</link>
					<comments>https://sqlsolutionsgroup.com/visual-studio-2019-ssis-projects/#comments</comments>
		
		<dc:creator><![CDATA[Randy Knight]]></dc:creator>
		<pubDate>Tue, 21 Jan 2020 15:24:00 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=4505</guid>

					<description><![CDATA[<p>Over the years we have seen lots of changes to the tools we use to develop SSIS packages. With the past few versions, the SQL Server project types (Database Projects, Integration Services (SSIS), Analysis Services (SSAS), and Reporting Services (SSRS)) have been moved from their own installer to installation via Visual Studio Extensions. This makes [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/visual-studio-2019-ssis-projects/">Visual Studio 2019 SSIS Projects</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="font-family: Times New Roman; font-size: 12pt;">Over the years we have seen lots of changes to the tools we use to develop SSIS packages. With the past few versions, the SQL Server project types (Database Projects, Integration Services (SSIS), Analysis Services (SSAS), and Reporting Services (SSRS)) have been moved from their own installer to installation via Visual Studio Extensions.<br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;">This makes perfect sense to Visual Studio developers, as extensions are the normal way for extending the platform to do different things. But for DBAs and BI developers who may not be accustomed to this, it can be a bit confusing.<br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;">I won&#8217;t re-invent the wheel here by showing how to install each of these, as there are plenty of resources out there. The basics are that the database projects (i.e SQL Server Data Tools) are installed as a Visual Studio Workload, and the SSIS, SSRS, and SSAS are installed as extensions (although the SSIS extension comes as an executable rather than a .vsix file).</span></p>
<hr />
<p class="has-text-align-center" style="font-size: 20px;">Who on your team is proactively protecting your</p>
<p class="has-text-align-center" style="font-size: 20px;">SQL Server estate? If your strategy is rubbing a</p>
<p class="has-text-align-center" style="font-size: 20px;">rabbit&#8217;s foot and keeping your fingers crossed,</p>
<p class="has-text-align-center" style="font-size: 20px;"><span style="text-decoration: underline;"><a href="https://sqlsolutionsgroup.com/about/contact-us/" target="_blank" rel="noopener noreferrer">let&#8217;s talk</a></span> before something goes wrong. </p>
<p class="has-text-align-center" style="font-size: 20px;"><strong>Because it will</strong>.</p>
<hr />
<p><span style="font-family: Times New Roman; font-size: 12pt;">However, one of the things I discovered is that even after adding the Integration Services extension, it is not very intuitive how to create a new SSIS project. In the past, we had the Business Intelligence Category of project and would just choose it from there. But in Visual Studio 2019, when you go to create a new project, that option does not exist.<br /></span></p>
<p><img loading="lazy" decoding="async" class="alignnone" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/010320_2129_VisualStudi1.png" alt="Visual Studio" width="553" height="426" /><span style="font-family: Times New Roman; font-size: 12pt;"><br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;">I thought it might be under Extensions, which would make sense because these are installed as extension, but that is not the case either. In fact, nothing shows up when choosing that project type.<br /></span></p>
<p><img loading="lazy" decoding="async" class="" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/010320_2129_VisualStudi2.png" alt="" width="554" height="228" /><span style="font-family: Times New Roman; font-size: 12pt;"><br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;">What you need to do is enter <strong>Integration Services</strong> or<strong> SSIS</strong> in the search box to find it.<br /></span></p>
<p><img loading="lazy" decoding="async" class="" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/010320_2129_VisualStudi3.png" alt="" width="554" height="367" /><span style="font-family: Times New Roman; font-size: 12pt;"><br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;">Once you&#8217;ve created your Integration Services Project, you&#8217;ll see the familiar project layout from prior versions.<br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;"> <img loading="lazy" decoding="async" class="" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/011620_2231_VisualStudi1.png" alt="" width="554" height="409" /><br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;"> <img loading="lazy" decoding="async" class="" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/011620_2231_VisualStudi2.png" alt="" width="557" height="516" /><br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;">The other issue is that some of these things are hard to find.  Greg Low does a great job in <a href="https://blog.greglow.com/2020/01/01/bi-wondering-why-your-ssrs-ssas-and-ssis-menus-are-missing-in-visual-studio-2019/">this article</a> on that one.<br /></span></p>
<p><span style="font-family: Times New Roman; font-size: 12pt;"> </span></p>
<p>The post <a href="https://sqlsolutionsgroup.com/visual-studio-2019-ssis-projects/">Visual Studio 2019 SSIS Projects</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/visual-studio-2019-ssis-projects/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Can not create Catalog (SSISDB) due to an error</title>
		<link>https://sqlsolutionsgroup.com/catalog-ssisdb/</link>
					<comments>https://sqlsolutionsgroup.com/catalog-ssisdb/#comments</comments>
		
		<dc:creator><![CDATA[Steve Rezhener]]></dc:creator>
		<pubDate>Tue, 14 Jan 2020 07:09:00 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[Catalog]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">https://sqlsolutionsgroup.com/?p=4513</guid>

					<description><![CDATA[<p>The post <a href="https://sqlsolutionsgroup.com/catalog-ssisdb/">Can not create Catalog (SSISDB) due to an error</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3><strong>Introduction</strong></h3>
<p>The SSISDB database (a.k.a. the SQL Server Integration Services catalog) was introduced back in SQL Server 2012 as a way to de-clutter the MSDB database and provide some built-in logging and reporting infrastructure. In a nutshell, SSISDB is an SSIS framework making SQL Server Integration Services more robust and enterprise-friendly by providing the following features:</p>
<ul>
<li>Database backup</li>
<li>Database encryption</li>
<li>Support for environments</li>
<li>Support project and package parameters</li>
<li>Package versioning</li>
<li>Custom SSRS performance reports built into SSMS</li>
<li>Deployment directly from SSDT</li>
</ul>
<p>Fortunately or unfortunately, installation of a new SQL Server instance does not include the creation of the SSISDB Catalog, even if SQL Server Integration Services is included in the installation. For some reason, Microsoft decided to leave that part to the user (luckily, this is a one-time sunk cost).</p>
<p>Once SQL Server installation is completed, you would need to create Catalog using SSMS (see Fig #1) by expanding Management, right clicking on Integration Services Catalogs, and clicking on Create Catalog menu item (see Figure 1).</p>
<figure id="attachment_4514" aria-describedby="caption-attachment-4514" style="width: 352px" class="wp-caption alignnone"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog1.png"><img loading="lazy" decoding="async" class="wp-image-4514 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog1.png" alt="ssis catalog" width="352" height="297" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog1.png 352w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog1-300x253.png 300w" sizes="(max-width: 352px) 100vw, 352px" /></a><figcaption id="caption-attachment-4514" class="wp-caption-text"><strong>Figure 1 &#8211; Create Catalog</strong></figcaption></figure>
<h3><strong>Problem</strong></h3>
<p>Once you are done with the full SQL Server installation and ready to create Catalog (SSISDB Catalog to be exact), you might be “greeted” with the following error – “<code>The catalog backup file 'C:\Program Files\Microsoft SQL Server\140\DTS\Binn\SSISDBBackup.bak' could not be accessed. Make sure the database file exists, and the SQL Server service account is able to access it.(Microsoft.SqlServer.IntegrationServices.Common.ObjectModel)</code>“.</p>
<p>I’m sure you were surprised as I am! What? Why would creation of SSISDB Catalog have anything to do with SSISDB database backup (see Fig #2)? Apparently it’s one of the internal steps that Microsoft does behind the scenes when you are installing SQL Server. To be absolutely specific, installation of an Integration Services feature. Strange, right? The real problem is that when you are trying to create an SSISDB Catalog, Microsoft “assumes” that there is database backup file (see Figure 2).</p>
<figure id="attachment_4515" aria-describedby="caption-attachment-4515" style="width: 887px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog2.png"><img loading="lazy" decoding="async" class="size-full wp-image-4515" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog2.png" alt="" width="887" height="357" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog2.png 887w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog2-300x121.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog2-768x309.png 768w" sizes="(max-width: 887px) 100vw, 887px" /></a><figcaption id="caption-attachment-4515" class="wp-caption-text"><strong>Figure 2 – SSISDBBackup.bak</strong></figcaption></figure>
<h3><strong>Solution</strong></h3>
<p>Apparently, if you forget to enable installation of Integration Services feature, this is the message that you are going to see. The solution involves going back to the installation (see Figure 3) and checking the Integration Services feature.</p>
<figure id="attachment_4516" aria-describedby="caption-attachment-4516" style="width: 789px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog3.png"><img loading="lazy" decoding="async" class="size-full wp-image-4516" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog3.png" alt="" width="789" height="359" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog3.png 789w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog3-300x137.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog3-768x349.png 768w" sizes="(max-width: 789px) 100vw, 789px" /></a><figcaption id="caption-attachment-4516" class="wp-caption-text"><strong>Figure 3 – SQL Server Installation Center</strong></figcaption></figure>
<figure id="attachment_4517" aria-describedby="caption-attachment-4517" style="width: 899px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog4.png"><img loading="lazy" decoding="async" class="wp-image-4517 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog4.png" alt="SQL Server Integration Services" width="899" height="546" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog4.png 899w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog4-300x182.png 300w, https://sqlsolutionsgroup.com/wp-content/uploads/2020/01/ssis-catalog4-768x466.png 768w" sizes="(max-width: 899px) 100vw, 899px" /></a><figcaption id="caption-attachment-4517" class="wp-caption-text"><strong>Figure 4 – Integration Services </strong></figcaption></figure>
<p>Once you have Integration Services enabled (see Figure 4) and the installation completed, you should be able to Create Catalog without any problem.</p>
<h3><strong>Disclaimer</strong></h3>
<p>This blog post is based on the following forum discussion <a href="https://www.sqlservercentral.com/forums/topic/missing-ssisdbbackup-bak">https://www.sqlservercentral.com/forums/topic/missing-ssisdbbackup-bak</a>.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/catalog-ssisdb/">Can not create Catalog (SSISDB) due to an error</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/catalog-ssisdb/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SSISDB Catalog Defaults Best Practices</title>
		<link>https://sqlsolutionsgroup.com/ssisdb-catalog/</link>
					<comments>https://sqlsolutionsgroup.com/ssisdb-catalog/#comments</comments>
		
		<dc:creator><![CDATA[Steve Rezhener]]></dc:creator>
		<pubDate>Wed, 18 Dec 2019 18:15:52 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">http://sqlsolutionsgroup.com/?p=4462</guid>

					<description><![CDATA[<p>The post <a href="https://sqlsolutionsgroup.com/ssisdb-catalog/">SSISDB Catalog Defaults Best Practices</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-1.jpg"><img loading="lazy" decoding="async" class="aligncenter wp-image-4463 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-1.jpg" alt="SSISDB Catalog" width="404" height="237" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-1.jpg 404w, https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-1-300x176.jpg 300w" sizes="(max-width: 404px) 100vw, 404px" /></a></h3>
<h3><strong>Introduction</strong></h3>
<p>The SSISDB database (a.k.a. the <a href="https://docs.microsoft.com/en-us/sql/integration-services/catalog/ssis-catalog?view=sql-server-ver15">Integration Services catalog</a>) was introduced back in SQL Server 2012 to de-clutter the MSDB database and provide an in-house logging and reporting infrastructure. In a nutshell, SSISDB is an SSIS framework making SQL Server Integration Services more robust and enterprise-friendly by providing:</p>
<ul>
<li>Database backup</li>
<li>Database encryption</li>
<li>Support for environments</li>
<li>Support project and package parameters</li>
<li>Package versioning</li>
<li>Customer SSRS performance reports built into SSMS</li>
<li>Deployment directly from SSDT</li>
</ul>
<p>While SSISDB framework made SSIS much more capable, it came with some Microsoft assumptions (a.k.a. defaults). Those defaults are there to help you to stand on your feet, but might not be optimal when you start running, and are <strong>far from perfect</strong> when you are sprinting.</p>
<p>This article addresses the defaults, why those defaults might not be optimal, and how to change those defaults.</p>
<h3><strong>Problem</strong></h3>
<p>SSISDB Catalog ships with a built-in process to clean up operations and project versioning. This cleanup process relies on SSISDB defaults that might make your SSIS inoperable if not changed.</p>
<p>Virtually every new SSIS project starts with building and running just a few packages while there is an abundance of free disk space. Fast forward 3-6 months and you have a number of SSIS projects, tens or hundreds of packages, and you might also have a need for a fresh data for reporting and analytics (<strong>read</strong>: constantly running packages around the clock). Those SSIS packages might accumulate versioning data (less of a problem) and logging data (more of a problem) way beyond Microsoft cleanup defaults which might lead to SSISDB database size to balloon and grow in size unexpectedly (<strong>read</strong>: eat up all the available disk space).</p>
<p>The single default that is responsible to capture SSIS run-time related data is Server-wide Default Logging Level = Basic. This setting is ultimately what manages the SSISDB database size and ultimately taking up the disk space. That being said, <a href="https://docs.microsoft.com/en-us/sql/integration-services/catalog/ssis-catalog?view=sql-server-2014">SSIS Catalog</a> (Fig 1) provides other options to control the SSISDB database size/disk space:</p>
<ol>
<li>Server-wide Default Logging Level</li>
<li>Clean-up defaults:
<ol>
<li>Clean Logs Periodically = True</li>
<li>Periodically Remove Old Versions = True</li>
<li>Retention Period (days) = 365</li>
<li>Maximum Number of Versions per Projects = 10</li>
</ol>
</li>
</ol>
<figure id="attachment_4464" aria-describedby="caption-attachment-4464" style="width: 616px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-2.png"><img loading="lazy" decoding="async" class="wp-image-4464 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-2.png" alt="" width="616" height="284" srcset="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-2.png 616w, https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-2-300x138.png 300w" sizes="(max-width: 616px) 100vw, 616px" /></a><figcaption id="caption-attachment-4464" class="wp-caption-text"><strong>Fig 1 -SSISDB defaults</strong></figcaption></figure>
<p>While changes to Server-wide Default Logging Level from Basic to None to regain disk space is highly unpractical and will make troubleshooting a nightmare, changes to other SSISDB Catalog settings like Maximum Number of Versions per Projects and Retention Period (days) can have minimal effect on troubleshooting, while keeping SSISDB database/disk space in control.</p>
<p>All those defaults are driving the cleanup process (a.k.a. SSIS Server Maintenance Job). While both Clean Logs Periodically = True and Periodically Remove Old Versions = True are virtually always perfect, settings for both Maximum Number of Versions per Projects = 10 and Retention Period (days) = 365 might be overoptimistic. And here is why.</p>
<p>The main reason why both Clean Logs Periodically = True and Periodically Remove Old Versions = True defaults are perfect is, without those defaults (or effectively if both changed to False), SSISDB will grow indefinitely as it will only accumulate log and versioning data without removing any data and run out of disk space.</p>
<p>The main reason why both Maximum Number of Versions per Projects = 10 and Retaining logging data for 365 days might be overoptimistic is Microsoft&#8217;s decision to retain the data based on a time period and not size. That means the fixed period number is not taking into account how much data will be accumulated. While Maximum Number of Versions per Projects might grow into a problem once you have thousands of packages, Retention Period (days) is going to become a huge problem once you have packages that are running every few minutes. I don’t think Microsoft ever expected accumulation of log data for 1440 runs a day (running every minute) which will require a cleanup more often than every 365 days or it will run out disk space.</p>
<h3><strong>Solution</strong></h3>
<p>The solution would involve changing the defaults to smaller numbers, so SSISDB keeps less information. Based on my personal experience of running packages every minute (e-commerce platform requirement) and having up to 10 projects, decreasing Retention Period (days) from 365 (default) to 7 days and Maximum Number of Versions per Projects from 10 (default) to 5 would suffice to control SSISDB/disk space while keeping enough information for debugging and troubleshooting purposes.</p>
<p>You have two options to make this change:</p>
<ul>
<li>Change defaults using SQL Server Management Studio (a.k.a. “SSMS”) by expanding Integration Services, right-clicking SSISDB and then clicking on the Properties menu-item (Fig 2 – SSMS).</li>
</ul>
<figure id="attachment_4465" aria-describedby="caption-attachment-4465" style="width: 300px" class="wp-caption alignnone"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-3.jpg"><img loading="lazy" decoding="async" class="wp-image-4465 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-3.jpg" alt="" width="300" height="151" /></a><figcaption id="caption-attachment-4465" class="wp-caption-text"><strong>Fig 2 – SSMS</strong></figcaption></figure>
<ul>
<li>Change defaults using T-SQL below to update records in <a href="https://docs.microsoft.com/en-us/sql/integration-services/system-views/catalog-catalog-properties-ssisdb-database?view=sql-server-ver15"> ssisdb.catalog.catalog_properties</a> table directly.</li>
</ul>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">UPDATE</span> ssisdb.<span class="kw1">CATALOG</span>.<span class="me1">catalog_properties</span>
<span class="kw1">SET</span> property_value <span class="sy0">=</span> 5
<span class="kw1">WHERE</span> property_name <span class="sy0">=</span> <span class="st0">'MAX_PROJECT_VERSIONS'</span>
&nbsp;
<span class="kw1">UPDATE</span> ssisdb.<span class="kw1">CATALOG</span>.<span class="me1">catalog_properties</span>
<span class="kw1">SET</span> property_value <span class="sy0">=</span> 7
<span class="kw1">WHERE</span> property_name <span class="sy0">=</span> <span class="st0">'RETENTION_WINDOW'</span></pre></div></div>
<p>&nbsp;</p>
<p>Once the change is completed, you should be able to confirm that changes by running the T-SQL query below (Fig 3 – SSISDB Catalog)</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> <span class="sy0">*</span> 
<span class="kw1">FROM</span> ssisdb.<span class="kw1">CATALOG</span>.<span class="me1">catalog_properties</span></pre></div></div>
<p>&nbsp;</p>
<figure id="attachment_4466" aria-describedby="caption-attachment-4466" style="width: 300px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-4.jpg"><img loading="lazy" decoding="async" class="wp-image-4466 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb-4.jpg" alt="" width="300" height="254" /></a><figcaption id="caption-attachment-4466" class="wp-caption-text"><strong>Fig 3 – SSIS Catalog</strong></figcaption></figure>
<p>While changing defaults might fix the problem going forward, it might not fix your existing SSISDB disk space problem quick enough. You can speed up the cleanup process by modifying the code and changing @delete_batch_size from 1000 to like 10000 by altering ssisdb.internal.cleanup_server_retention_window stored procedure (Fig 4 – Retention Procedure).</p>
<figure id="attachment_4467" aria-describedby="caption-attachment-4467" style="width: 300px" class="wp-caption aligncenter"><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb5.jpg"><img loading="lazy" decoding="async" class="wp-image-4467 size-full" src="https://sqlsolutionsgroup.com/wp-content/uploads/2019/12/ssisdb5.jpg" alt="" width="300" height="84" /></a><figcaption id="caption-attachment-4467" class="wp-caption-text"><strong>Fig 4- Retention Procedure</strong></figcaption></figure>
<h3>Summary</h3>
<p>This article highlighted a potential problem with SSISDB Catalog defaults that might lead to running out of disk space and provided a solution that would force SSISDB to retain less information.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/ssisdb-catalog/">SSISDB Catalog Defaults Best Practices</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/ssisdb-catalog/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How to deploy SSIS packages using SSDT from an untrusted domain</title>
		<link>https://sqlsolutionsgroup.com/deploy-ssis-packages/</link>
					<comments>https://sqlsolutionsgroup.com/deploy-ssis-packages/#comments</comments>
		
		<dc:creator><![CDATA[Steve Rezhener]]></dc:creator>
		<pubDate>Thu, 24 Oct 2019 17:45:47 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSDT]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">http://sqlsolutionsgroup.com/?p=4399</guid>

					<description><![CDATA[<p>The post <a href="https://sqlsolutionsgroup.com/deploy-ssis-packages/">How to deploy SSIS packages using SSDT from an untrusted domain</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><img loading="lazy" decoding="async" class="alignnone" src="https://steverezhener.files.wordpress.com/2019/10/deployssisusingssdt.png?w=616" alt="deploy SSIS packages" width="616" height="324" /></p>
<h3><strong>Introduction</strong></h3>
<p>To deploy SSIS packages from SSDT to SSISDB, using Integration Services Deployment Wizard is one of the simplest and interactive ways. All you have to do is to right-click the package and click on Deploy, go through a few menus and you are done.</p>
<h3><strong>Problem</strong></h3>
<p>Unfortunately, SSIS is too bound to an Active Directory and would only utilize Windows authentication to understand “who can do what”. If both machines (source/deployed from and target/deployed to) are on the same domain or have domain trust/forest, you are in luck, but what if they are not? Additionally, if your development machine is running Windows 10 Home or iMac, you might not even have an option of the domain.</p>
<p>Additionally, we are in a public cloud era, so your company can have private and public cloud domains that are not connected (trusted). That makes the deployment from one machine to another quite a pain.</p>
<h3><strong>Solution</strong></h3>
<p>What if you could type the AD credentials of the machine you are trying to deploy to when firing up SSDT on your development machine? In that case, Integration Services Deployment Wizard will see the proper credentials and everything will work like it was on the same domain.</p>
<p>Sysinternals comes to rescue – <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/shellrunas">https://docs.microsoft.com/en-us/sysinternals/downloads/shellrunas</a>. ShellRunAs allows you to specify a different username/password when opening a new application. It is very similar to RunAs Administrator except that you can type a new username and password. Once SSDT gets the credentials of the target machine, everything works like a charm.</p>
<p><img decoding="async" src="https://steverezhener.files.wordpress.com/2019/10/shellrunas.jpg?w=616" alt="ShellRunas.jpg" /></p>
<p>Thanks go to Randy Knight for showing me that trick to deploy SSIS packages! I wish Microsoft would incorporate that handy tool into SSDT to make deployment more consistent.</p>
<hr />
<h4><i>If you still want to take a step back and create a new SSIS package, we recommend taking a look at the </i><em><span style="text-decoration: underline;"><a href="https://www.sentryone.com/create-ssis-package-guide">guide prepared by SentryOne</a></span></em><i>. You can find information on how to create an SSIS project to add a data flow task.</i></h4>
<p>The post <a href="https://sqlsolutionsgroup.com/deploy-ssis-packages/">How to deploy SSIS packages using SSDT from an untrusted domain</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/deploy-ssis-packages/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Synonyms in SQL Server &#8211; Good and Bad</title>
		<link>https://sqlsolutionsgroup.com/synonyms-sql-server-good-bad/</link>
					<comments>https://sqlsolutionsgroup.com/synonyms-sql-server-good-bad/#respond</comments>
		
		<dc:creator><![CDATA[Jason Brimhall]]></dc:creator>
		<pubDate>Tue, 01 Jul 2014 16:00:37 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">http://sqlsolutionsgroup.com/?p=1123</guid>

					<description><![CDATA[<p>When SQL Server 2005 was released, a nifty little feature was included called synonyms.  Despite being around since SQL Server 2005, I think this feature is often under-utilized or, more importantly, it is implemented in a very bad way. Today I want to share a couple of examples.  We will take a look at examples [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/synonyms-sql-server-good-bad/">Synonyms in SQL Server &#8211; Good and Bad</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When SQL Server 2005 was released, a nifty little feature was included called synonyms.  Despite being around since SQL Server 2005, I think this feature is often under-utilized or, more importantly, it is implemented in a very bad way.</p>
<p>Today I want to share a couple of examples.  We will take a look at examples of both good and bad implementations of synonyms.</p>
<p>First, let&#8217;s take a look at the syntax for creating a synonym.  Per <a href="https://msdn.microsoft.com/en-us/library/ms177544.aspx">BOL</a> (and for the fun of it, here is the 2005 <a href="https://msdn.microsoft.com/en-us/library/ms177544(v=sql.90).aspx">link</a>).</p>
<p><div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="co1">-- SQL Server Syntax</span>
&nbsp;
<span class="kw1">CREATE</span> SYNONYM <span class="br0">[</span> schema_name_1. <span class="br0">]</span> synonym_name <span class="kw1">FOR</span> <span class="sy0">&lt;</span>object<span class="sy0">&gt;</span>
&nbsp;
<span class="sy0">&lt;</span>object<span class="sy0">&gt;</span> :: <span class="sy0">=</span>
<span class="br0">&#123;</span>
    <span class="br0">[</span> server_name.<span class="br0">[</span> database_name <span class="br0">]</span> . <span class="br0">[</span> schema_name_2 <span class="br0">]</span>. <span class="kw2">OBJECT_NAME</span> 
  <span class="sy0">|</span>  database_name . <span class="br0">[</span> schema_name_2 <span class="br0">]</span>.<span class="sy0">|</span> schema_name_2. <span class="br0">]</span> <span class="kw2">OBJECT_NAME</span>
<span class="br0">&#125;</span>
<span class="co1">-- Windows Azure SQL Database Syntax</span>
&nbsp;
<span class="kw1">CREATE</span> SYNONYM <span class="br0">[</span> schema_name_1. <span class="br0">]</span> synonym_name <span class="kw1">FOR</span> <span class="sy0">&lt;</span> <span class="kw1">OBJECT</span> <span class="sy0">&gt;</span>
&nbsp;
<span class="sy0">&lt;</span> <span class="kw1">OBJECT</span> <span class="sy0">&gt;</span> :: <span class="sy0">=</span>
<span class="br0">&#123;</span>
    <span class="br0">[</span>database_name. <span class="br0">[</span> schema_name_2 <span class="br0">]</span>.<span class="sy0">|</span> schema_name_2. <span class="br0">]</span> <span class="kw2">OBJECT_NAME</span>
<span class="br0">&#125;</span></pre></div></div></p>
<p>So a sample implementation of a Synonym could be something like the following.</p>
<div id="crayon-5d72bc03599bb751162794" class="crayon-syntax crayon-theme-orange-code crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover">
<p><div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">CREATE</span> SYNONYM <span class="br0">[</span>syn<span class="br0">]</span>.<span class="br0">[</span>Staging_Cardumum<span class="br0">]</span> <span class="kw1">FOR</span> <span class="br0">[</span>Cardamum_UAT<span class="br0">]</span>.<span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>cardamum_staging<span class="br0">]</span>
GO</pre></div></div></p>
</div>
<div data-settings=" minimize scroll-mouseover"></div>
<div data-settings=" minimize scroll-mouseover">
<p>Before we delve into that sample synonym, lets look at an example of a really bad implementation.</p>
<h2>The BAD</h2>
<p>While working with a client, I received a request to look into why a linked server query was failing.  (This isn’t necessarily the bad, just hang in there for a bit.)  The message was something like this:</p>
</div>
<blockquote><p>The OLE DB provider “SQLNCLI10” for linked server “blahblahblah” indicates that either the object has no columns or the current user does not have permissions on that object.</p></blockquote>
<p>The error message seems at least semi-descriptive and gives a starting point.  In this case, I decided to verify the linked server was created properly, verified that the permissions were done properly and even tested the linked server.  On the source (linked) and destination server (let’s call the Source server ServerA and the Destination server we will call ServerB), I verified that permissions were in place for each database to be touched.  Still no dice!</p>
<p>Well, let’s go take a look and see if that referenced table actually exists.  It did not!  Does it exist as a view?  It did not!  Alas, the table existed as a synonym.  This is where it gets wonky.  In looking at the definition of the synonym, I found that the table defined in the synonym had a linked server table as its source.  To top things off, the linked server was back on the originating server that was coming across the link in the first place.  So yes, that would be ServerB initiated a query against ServerA to pull data back to ServerB.  But the data needed (as defined by the vendor) was available on ServerA – supposedly.  Reality had that data actually sitting on ServerB the whole time.</p>
<p>At any rate, thanks to having a synonym for each and every table sitting on ServerA that referenced a table across a linked server on ServerB, we had mass confusion.  In the end, the query was far simpler to execute by just pulling it from the originating query server (ServerB).</p>
<p>This implementation of a synonym was not the best.  All it did was cause confusion, create documentation inaccuracies and delay the developer from accomplishing her task.  Do you really need 1000s of synonyms in your database?  Do you need all of them going across a linked server?  If you do, did you ever think about the potential for performance issues?  (The vendor in this case used those linked servers and synonyms to perform a data conversion that took 36 hrs each time for a rather small dataset – ouch!!!!).</p>
<h2>On the other Hand</h2>
<p>Imagine, if you will, two databases sitting on the same box.  One database will be for your user data, and the other for “staging” data for processes such as those related to ETL.  Imagine further that, for some inane reason, the naming standard of your databases must include the suffix denoting the environment of the database.</p>
<p>Now picture an SSIS package that must utilize tables from both databases in data sources somehow.  At least one of the tables has millions of records.  And both of the tables have nearly 100 columns.  Even just pulling in the minimum amount of data using a query from each source can cause memory issues.  Two separate data sources means you will likely have a sort transformation (for each source) as well as a join transformation.</p>
<p>Trying to reduce the amount of data in the larger table source could be done via TSQL.  But to reference a database in one environment versus another environment means a code change with each deployment (due to the TSQL – think three part naming).  So you have been hampered by the environment.  Or have you?</p>
<p>By using a synonym in this situation, the data can be joined in a tsql data source by referencing that synonym.  Let’s look back at the sample synonym posted earlier in this article.</p>
<p><div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">CREATE</span> SYNONYM <span class="br0">[</span>syn<span class="br0">]</span>.<span class="br0">[</span>Staging_Cardumum<span class="br0">]</span> <span class="kw1">FOR</span> <span class="br0">[</span>Cardamum_UAT<span class="br0">]</span>.<span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>cardamum_staging<span class="br0">]</span>
GO</pre></div></div></p>
<p>You can see that this synonym follows the same sort of naming standards as was just laid out in the preceding scenario.  If I create a synonym in each environment by the same name, and referencing the appropriate environment named database, I have just opened up a performance tweak for my SSIS datasource.</p>
<p>By implementing this slight tweak, I have been able to gain a 10x performance improvement in package performance.  I am now requiring SSIS to ingest fewer records and thus chew up less memory.  Fewer transformations are required and the package can just fly into the required transformations, rather than tinkering around with the transformations needed to just get the data into a usable state for those transformations.</p>
<p>There are other benefits within SSIS to using synonyms for databases on the same server as well.  Especially when dealing with this kind of naming standard that requires the databases to be named differently in each environment.</p>
<h2>Conclusion</h2>
<p>How you use a synonym can be a huge asset or it can be a significant dampener to performance.  There are benefits and uses for these nifty little things.  Check them out and let us know how you have been able to put synonyms to use to benefit you.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/synonyms-sql-server-good-bad/">Synonyms in SQL Server &#8211; Good and Bad</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/synonyms-sql-server-good-bad/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>An SSIS design pattern for capturing and reporting on bad data</title>
		<link>https://sqlsolutionsgroup.com/ssis-design-pattern/</link>
					<comments>https://sqlsolutionsgroup.com/ssis-design-pattern/#comments</comments>
		
		<dc:creator><![CDATA[Randy Knight]]></dc:creator>
		<pubDate>Tue, 24 Jun 2014 16:23:44 +0000</pubDate>
				<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[ETL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">http://sqlsolutionsgroup.com/?p=1052</guid>

					<description><![CDATA[<p>One of the requirements of ETL is ensuring that bad data does not cause the whole ETL process to stop with an error. Failure to do this results in a very brittle process in which one row of bad data can cause a whole day’s worth of data loading to fail. My favorite war story [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/ssis-design-pattern/">An SSIS design pattern for capturing and reporting on bad data</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>One of the requirements of ETL is ensuring that bad data does not cause the whole ETL process to stop with an error. Failure to do this results in a very brittle process in which one row of bad data can cause a whole day’s worth of data loading to fail. My favorite war story about this is a customer who had an ETL developer who spent 40% of her time every week keeping the lights on for one ETL process. She had written it many years before and it had become <strong><em>almost half of her job</em></strong> just to keep it running.</p>
<p>The fact of the matter is that computer systems have always had the GIGO (garbage in garbage out) problem. Assuming that data will come in clean is always a recipe for failure.  Instead, one must assume the data will come in dirty in a variety of ways (some yet unknown) and handle this bad data in the SSIS package.</p>
<h3><strong>The Problem</strong></h3>
<p>SSIS does a great job of error logging and providing built-in methods to redirect data to different flows based on many different configurable items. Pretty much anything you can think of to look at and decide where to send it, you can do. What it doesn’t do a very good job of out of the box is providing a generic place to put the bad data in an easily human- readable format for troubleshooting after the fact.</p>
<p>Observe the following common data flow error handling pattern for loading a fact table. A lookup component retrieves the foreign key from a dimension table and sends the row on through the data flow if there is a match. If it doesn’t match, the row is sent elsewhere, in this case to a text file connection. A DBA or analyst then has the responsibility to monitor the text files, find where the error was, fix the issue and reprocess the data. This is what the developer above was spending most of that time on.</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image52.png"><img loading="lazy" decoding="async" class="alignnone" style="display: inline; background-image: none;" title="image" src="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image52_thumb.png" alt="data flow error handling pattern" width="718" height="356" border="0" /></a></p>
<p>There are several problems with this approach:</p>
<ul>
<li>I have to have a separate text file for every place in my ETL process where I might encounter bad data.</li>
<li>All that goes in the text file is a comma-delimited list of data. Not very user friendly when it comes to troubleshooting time.</li>
<li>I’ll have to come up with a way to dynamically name the text files with a timestamp, etc., in order to not overwrite the file every day. Otherwise yesterday’s bad data may be overwritten in today’s ETL run.</li>
</ul>
<h3><strong>The Solution</strong></h3>
<p>In the engagement described above, I was asked to fix the ETL process in question to make it more robust and not so brittle and prone to failure. The customer also wanted an easier way to identify and analyze the bad data so that end user analysts could take over that task and it would not require developer or BA resources. This is the solution I came up with.</p>
<p><strong><span style="text-decoration: underline;">Table</span></strong></p>
<p>First, we need a table in which to store the bad data. In order to prevent having to have a unique table for each place this is used, I decided to store the data as XML in a single table.  That way, this becomes a generic solution that can be used regardless of the number of columns, data types, etc.</p>
<p><div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> <span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>ErrorRows_XML<span class="br0">]</span><span class="br0">&#40;</span>
	<span class="br0">[</span>ErrorID<span class="br0">]</span> <span class="br0">[</span><span class="kw1">INT</span><span class="br0">]</span> <span class="kw1">IDENTITY</span><span class="br0">&#40;</span>1,1<span class="br0">&#41;</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span>,
	<span class="br0">[</span>ErrorDate<span class="br0">]</span> <span class="br0">[</span><span class="kw1">DATETIME</span><span class="br0">]</span> <span class="sy0">NOT</span> <span class="sy0">NULL</span>,
	<span class="br0">[</span>ErrorSource<span class="br0">]</span> <span class="br0">[</span><span class="kw1">VARCHAR</span><span class="br0">]</span><span class="br0">&#40;</span>500<span class="br0">&#41;</span> <span class="sy0">NULL</span>,
	<span class="br0">[</span>ErrorCount<span class="br0">]</span> <span class="br0">[</span><span class="kw1">INT</span><span class="br0">]</span> <span class="sy0">NULL</span>,
	<span class="br0">[</span>RowData<span class="br0">]</span>
<span class="br0">[</span>xml<span class="br0">]</span><span class="br0">[</span><span class="sy0">/</span>xml<span class="br0">]</span>
<span class="sy0">NULL</span>, <span class="br0">[</span>BatchID<span class="br0">]</span> <span class="br0">[</span><span class="kw1">INT</span><span class="br0">]</span> <span class="sy0">NULL</span>, <span class="kw1">CONSTRAINT</span> <span class="br0">[</span>PK_EFC_ErrorRows_XML<span class="br0">]</span> <span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="kw1">CLUSTERED</span> <span class="br0">&#40;</span><span class="br0">[</span>ErrorID<span class="br0">]</span> <span class="kw1">ASC</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> GO</pre></div></div></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The <strong>ErrorSource </strong>column is used to identify where in the ETL process this particular error occurred. I used the following naming convention for ErrorSource: <em>PackageName_DataFlowName_ComponentName. </em>So in the example above the ErrorSource would be <strong>factSales_Product_GetProductKey.</strong></p>
<p>The <strong>ErrorCount</strong> column is used to store how many rows are in this particular dataset. Remember that we are storing all the bad data from one given instance of the error in one row via XML.</p>
<p><strong>RowData</strong> contains the actual bad data in XML format.</p>
<p>Finally, in this case I have a<strong> BatchID</strong> column because this ETL process uses batches and it makes it easy to identify which run the bad data came from. This may not be necessary in all uses of this pattern.</p>
<p><strong><span style="text-decoration: underline;">The Package</span></strong></p>
<p>Continuing with our example, let’s modify the package to write the bad data to the table. We’re going to do that by using a Recordset destination. This destination stores the data in a variable for future use.</p>
<p>Here is the new data flow for the product lookup. When this data flow runs, the bad data will be stored as an ADO recordset in a variable.</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image56.png"><img loading="lazy" decoding="async" class="alignnone" style="display: inline; background-image: none;" title="image" src="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image56_thumb.png" alt="data flow for the product lookup" width="717" height="376" border="0" /></a></p>
<p>The recordset destination does not have it’s own GUI so we always use the advanced editor to configure it. But it’s configuration is very simple. The only configuration we have to do is choose the variable to send the output to and choose what columns we want to include in the recordset. This should be a package level variable with a data type of Object.</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image61.png"><img loading="lazy" decoding="async" class="alignnone" style="display: inline; background-image: none;" title="image" src="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image61_thumb.png" alt="Advanced Editor for Missing Products" width="720" height="679" border="0" /></a></p>
<p>&nbsp;</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image18.png"><img loading="lazy" decoding="async" style="display: inline; background-image: none;" title="image" src="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image_thumb18.png" alt="image" width="722" height="581" border="0" /></a></p>
<p>&nbsp;</p>
<p>At this point, we have an SSIS variable that contains the bad data. The last step is to add a Script Task to the package to serialize the data to XML and write it  to the table.</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image14.png"><img loading="lazy" decoding="async" class="alignnone" style="display: inline; background-image: none;" title="image" src="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image_thumb14.png" alt="an SSIS variable that contains the bad data" width="446" height="581" border="0" /></a></p>
<p>&nbsp;</p>
<p>In the script task properties, we include the object variable as a ReadOnly variable.</p>
<p><a href="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image15.png"><img loading="lazy" decoding="async" class="alignnone" style="display: inline; background-image: none;" title="image" src="https://sqlsolutionsgroup.com/wp-content/uploads/2014/06/image_thumb15.png" alt="ReadOnly variable" width="816" height="464" border="0" /></a></p>
<p>The script consists of a WriteError() function that does the heavy lifting. It uses the GetXML method of the ADO dataset object to serialize the data as XML. Then it’s a simple ADO call to write the XML data to the database.</p>
<p><div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><span class="kw1">using</span> <span class="co3">System</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">System.Data</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">Microsoft.SqlServer.Dts.Runtime</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">System.Windows.Forms</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">System.Xml</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">System.Data.SqlClient</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">System.Data.OleDb</span><span class="sy0">;</span>
<span class="kw1">using</span> <span class="co3">System.IO</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">namespace</span> ST_d98c4c2b62f94789a154c95495b6588e
<span class="br0">&#123;</span>
	<span class="br0">[</span>Microsoft.<span class="me1">SqlServer</span>.<span class="me1">Dts</span>.<span class="me1">Tasks</span>.<span class="me1">ScriptTask</span>.<span class="me1">SSISScriptTaskEntryPointAttribute</span><span class="br0">]</span>
	<span class="kw1">public</span> <span class="kw1">partial</span> <span class="kw4">class</span> ScriptMain <span class="sy0">:</span> Microsoft.<span class="me1">SqlServer</span>.<span class="me1">Dts</span>.<span class="me1">Tasks</span>.<span class="me1">ScriptTask</span>.<span class="me1">VSTARTScriptObjectModelBase</span>
	<span class="br0">&#123;</span>
       	<span class="kw1">public</span> <span class="kw1">void</span> Main<span class="br0">&#40;</span><span class="br0">&#41;</span> 
		<span class="br0">&#123;</span>
            WriteData<span class="br0">&#40;</span><span class="st0">&quot;BadData_ProductRecordset_MissingProducts&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
			Dts.<span class="me1">TaskResult</span> <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span>ScriptResults.<span class="me1">Success</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
&nbsp;
&nbsp;
        <span class="kw1">public</span> <span class="kw1">void</span> WriteData<span class="br0">&#40;</span><span class="kw4">string</span> variable<span class="br0">&#41;</span>
        <span class="br0">&#123;</span> 
            <span class="co1">//serialize to xml</span>
            OleDbDataAdapter da <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> OleDbDataAdapter<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
            DataTable dt <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> DataTable<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
            DataSet ds <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> DataSet<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
            da.<span class="me1">Fill</span><span class="br0">&#40;</span>dt, Dts.<span class="me1">Variables</span><span class="br0">[</span>variable<span class="br0">]</span>.<span class="me1">Value</span><span class="br0">&#41;</span><span class="sy0">;</span>
            ds.<span class="me1">Tables</span>.<span class="me1">Add</span><span class="br0">&#40;</span>dt<span class="br0">&#41;</span><span class="sy0">;</span>
            <span class="kw4">string</span> xml <span class="sy0">=</span> ds.<span class="me1">GetXml</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
            <span class="kw1">if</span> <span class="br0">&#40;</span>xml <span class="sy0">!=</span> <span class="st0">&quot;&lt;NewDataset /&gt;&quot;</span><span class="br0">&#41;</span>
            <span class="br0">&#123;</span>
                <span class="co1">//write to db</span>
                <span class="kw4">string</span> ErrSource <span class="sy0">=</span> Dts.<span class="me1">Variables</span><span class="br0">[</span>variable<span class="br0">]</span>.<span class="me1">Name</span><span class="sy0">;</span>
                <span class="kw4">string</span> BatchID <span class="sy0">=</span> Dts.<span class="me1">Variables</span><span class="br0">[</span><span class="st0">&quot;BatchID&quot;</span><span class="br0">]</span>.<span class="me1">Value</span>.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
                SqlConnection cn <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> SqlConnection<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
                cn <span class="sy0">=</span> <span class="br0">&#40;</span>SqlConnection<span class="br0">&#41;</span><span class="br0">&#40;</span>Dts.<span class="me1">Connections</span><span class="br0">[</span><span class="st0">&quot;DB1&quot;</span><span class="br0">]</span>.<span class="me1">AcquireConnection</span><span class="br0">&#40;</span>Dts.<span class="me1">Transaction</span><span class="br0">&#41;</span> <span class="kw1">as</span> SqlConnection<span class="br0">&#41;</span><span class="sy0">;</span>
                SqlCommand cmd <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> SqlCommand<span class="br0">&#40;</span><span class="st0">&quot;insert dbo.ErrorRows_XML(ErrorSource,RowData,BatchID) values (@ErrorSource, @XML, @BatchID)&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
                cmd.<span class="me1">Connection</span> <span class="sy0">=</span> cn<span class="sy0">;</span>
                cmd.<span class="me1">Parameters</span>.<span class="me1">Add</span><span class="br0">&#40;</span><span class="st0">&quot;@ErrorSource&quot;</span>, SqlDbType.<span class="me1">VarChar</span><span class="br0">&#41;</span>.<span class="me1">Value</span> <span class="sy0">=</span> ErrSource<span class="sy0">;</span>
                cmd.<span class="me1">Parameters</span>.<span class="me1">Add</span><span class="br0">&#40;</span><span class="st0">&quot;@XML&quot;</span>, SqlDbType.<span class="me1">Xml</span><span class="br0">&#41;</span>.<span class="me1">Value</span> <span class="sy0">=</span> xml<span class="sy0">;</span>
                cmd.<span class="me1">Parameters</span>.<span class="me1">Add</span><span class="br0">&#40;</span><span class="st0">&quot;@BatchID&quot;</span>, SqlDbType.<span class="kw4">Int</span><span class="br0">&#41;</span>.<span class="me1">Value</span> <span class="sy0">=</span> BatchID<span class="sy0">;</span>
                cmd.<span class="me1">ExecuteNonQuery</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span>
             <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></p>
<p>&nbsp;</p>
<p>Finally, I create a view for each ErrorSource using XQuery to parse the XML as easy to read data. Ultimately there could be a front end for this in .NET or even SSRS but I haven’t built that.  In any case this should be much more dynamic than having to create a view for each error but I just haven’t invested the time. Even so, having an analyst select from a view instead of poring through text files is much more user friendly.</p>
<p><div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img decoding="async" border="0" style="border: 0 none" src="https://sqlsolutionsgroup.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">CREATE</span> <span class="kw1">VIEW</span> <span class="br0">[</span>dbo<span class="br0">]</span>.<span class="br0">[</span>vBadData_ProductRecordset_MissingProducts<span class="br0">]</span>
<span class="kw1">AS</span>
<span class="kw1">SELECT</span> 
	x.<span class="me1">ErrorID</span>
	,x.<span class="me1">ErrorDate</span>
	,x.<span class="me1">BatchID</span>
	,tbl.<span class="me1">col</span>.<span class="kw1">VALUE</span><span class="br0">&#40;</span>N<span class="st0">'(SalesID)[1]'</span>,N<span class="st0">'bigint'</span><span class="br0">&#41;</span> <span class="kw1">AS</span> SalesID
	,tbl.<span class="me1">col</span>.<span class="kw1">VALUE</span><span class="br0">&#40;</span>N<span class="st0">'(ProductName)[1]'</span>,N<span class="st0">'varchar(50)'</span><span class="br0">&#41;</span> <span class="kw1">AS</span> ProductName
<span class="kw1">FROM</span> dbo.<span class="me1">ErrorRows_XML</span> x
cross apply RowData.<span class="me1">nodes</span><span class="br0">&#40;</span>N<span class="st0">'//Table1'</span><span class="br0">&#41;</span> <span class="kw1">AS</span> tbl<span class="br0">&#40;</span>col<span class="br0">&#41;</span>
<span class="kw1">WHERE</span> ErrorSource <span class="sy0">=</span> <span class="st0">'BadData_ProductRecordset_MissingProducts'</span></pre></div></div></p>
<p>The post <a href="https://sqlsolutionsgroup.com/ssis-design-pattern/">An SSIS design pattern for capturing and reporting on bad data</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/ssis-design-pattern/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Dynamic SSIS Error Logging</title>
		<link>https://sqlsolutionsgroup.com/dynamic-ssis-error-logging/</link>
					<comments>https://sqlsolutionsgroup.com/dynamic-ssis-error-logging/#respond</comments>
		
		<dc:creator><![CDATA[Randy Knight]]></dc:creator>
		<pubDate>Wed, 10 Oct 2012 11:05:57 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">http://sqlsolutionsgroup.com/blog/?p=150</guid>

					<description><![CDATA[<p>When building ETL processes, one of the things we always like to do is to account for every row.  But setting up error data flows can be very time consuming since they are schema dependent.  The following solutions is a generic way to log bad rows that can be re-used without modification. It is also [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/dynamic-ssis-error-logging/">Dynamic SSIS Error Logging</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When building ETL processes, one of the things we always like to do is to account for every row.  But setting up error data flows can be very time consuming since they are schema dependent.  The following solutions is a generic way to log bad rows that can be re-used without modification. It is also set-based so we are only writing one error row no matter how many errors we had.</p>
<p>The basis of the solution is that we store the data as XML.  This way we maintain the structure and schema and can shred it as needed later on but we don’t have to have schema-specific tables.</p>
<p>&nbsp;</p>
<p>To start with, we need a table to store the results.</p>
<pre class="csharpcode"><span class="kwrd">CREATE</span> <span class="kwrd">TABLE</span> [dbo].[ErrorRows_XML](
    [ErrorID] [<span class="kwrd">int</span>] <span class="kwrd">IDENTITY</span>(1,1) <span class="kwrd">NOT</span> <span class="kwrd">NULL</span> <span class="kwrd">PRIMARY</span> <span class="kwrd">KEY</span> <span class="kwrd">CLUSTERED</span>,
    [ErrorDate] [datetime] <span class="kwrd">NOT</span> <span class="kwrd">NULL</span>,
    [ErrorSource] [<span class="kwrd">varchar</span>](500) <span class="kwrd">NULL</span>,
    [ErrorCount] [<span class="kwrd">int</span>] <span class="kwrd">NULL</span>,
    [RowData] [xml] <span class="kwrd">NULL</span>,
)
<span class="kwrd">GO</span></pre>
<p>&nbsp;</p>
<p>The next thing we need to do is create an SSIS variable to store the results.  We are going to use a Recordset destination so we need a variable of type Object to store the Recordset in.</p>
<p>For the variable name, I use the following naming convention:</p>
<p align="left"><strong>Error_&lt;PackageName&gt;_&lt;CFStepName&gt;_&lt;DFStepName&gt;</strong></p>
<p>As you can see from the screenshot below, the DataType is Object and the Value is set for you as System.Object.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>In this example, I am using the No Match output of a Lookup transform.  If we can’t find the key, we don’t want the row to go to the fact table via the Match output, but we don’t want to lose the data either so we can troubleshoot the key issue.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The destination is a Recordset Destination, which uses the Advanced Editor.  On Component Properties, the only thing we need to specify is the VariableName, which we created in the previous step.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>On the Input Columns tab, we specify which columns from the data flow we want to store as XML.  I generally limit this as much as possible to just the data I need to figure out why this particular operation didn’t work.  In this case that would be the primary key of the input for the data flow and the columns used in the lookup.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>At this point, when the Data Flow runs, the rows to be logged will be stored in the Recordset variables.  The last step (typically at the end of the control flow) is a Script Task to write the data to the ErrorLog table created above.</p>
<p>&nbsp;</p>
<p>The variable we stored the data in needs to be specified in the Script Task (ReadOnly is fine).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The script uses this function to do the work.</p>
<pre class="csharpcode"> <span class="kwrd">public</span> <span class="kwrd">void</span> WriteError(<span class="kwrd">string</span> variable)
        {
            <span class="rem">//serialize to xml</span>
            OleDbDataAdapter da = <span class="kwrd">new</span> OleDbDataAdapter();
            DataTable dt = <span class="kwrd">new</span> DataTable();
            DataSet ds = <span class="kwrd">new</span> DataSet();

            da.Fill(dt, Dts.Variables[variable].Value);
            ds.Tables.Add(dt);
            <span class="kwrd">string</span> xml = ds.GetXml();

            <span class="kwrd">if</span> (xml != <span class="str">"&lt;NewDataSet /&gt;"</span>)
            {
                <span class="rem">//write to db</span>
                <span class="kwrd">string</span> ErrSource = Dts.Variables[variable].Name;
                SqlConnection cn = <span class="kwrd">new</span> SqlConnection();
                cn = (SqlConnection)(Dts.Connections[<span class="str">"DW01_ADO"</span>].AcquireConnection(Dts.Transaction) <span class="kwrd">as</span> SqlConnection);
                SqlCommand cmd = <span class="kwrd">new</span> SqlCommand(<span class="str">"insert dbo.EFC_ErrorRows_XML(ErrorSource,RowData) values(@ErrorSource, @XML)"</span>, cn);
                cmd.Parameters.Add(<span class="str">"@ErrorSource"</span>, SqlDbType.VarChar).Value = ErrSource;
                cmd.Parameters.Add(<span class="str">"@XML"</span>, SqlDbType.Xml).Value = xml;
                cmd.ExecuteNonQuery();
            }
        }</pre>
<p>&nbsp;</p>
<p>The body of the script just calls the function for each variable that contains errors.</p>
<pre class="csharpcode"> <span class="kwrd">public</span> <span class="kwrd">void</span> Main()
        {
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_TripKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_ActionKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_ServiceKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_ZoneKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_YardKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_MTTapDateKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_MTTapTimeKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_StopKeyEndDateNull1"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_NoPlatformKey2"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_RouteID0"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_PlatformKey1"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_NoPlatformKey3"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_NoPlatformKey1"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_AllStopKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_NoPlatformKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_InstitutionKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_ProductKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_CardKey"</span>);
            WriteError(<span class="str">"Error_FactEFCTaps_StageTaps_VehicleKeyTraxFR"</span>);

            Dts.TaskResult = (<span class="kwrd">int</span>)ScriptResults.Success;
        }</pre>
<p>&nbsp;</p>
<p>We now have the data in the Error Log table as XML</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>XQuery can be used to shred the XML to get at specific data.  For common errors, I create views for the specific error type.</p>
<pre class="csharpcode"><span class="kwrd">SELECT</span> 
    x.ErrorID
    ,x.ErrorDate
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(id_sess)[1]'</span>,N<span class="str">'bigint'</span>) <span class="kwrd">AS</span> id_sess
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(cardid)[1]'</span>,N<span class="str">'nvarchar(255)'</span>) <span class="kwrd">AS</span> CardID
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(CC_CompanyName)[1]'</span>,N<span class="str">'nvarchar(255)'</span>) <span class="kwrd">AS</span> CC_CompanyName
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(CDListMembership)[1]'</span>,N<span class="str">'nvarchar(255)'</span>) <span class="kwrd">AS</span> CDListMembership
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(FaceNumber)[1]'</span>,N<span class="str">'nvarchar(255)'</span>) <span class="kwrd">AS</span> FaceNumber
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(id_payee)[1]'</span>,N<span class="str">'bigint'</span>) <span class="kwrd">AS</span> id_payee
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(LastCDListChangeDate)[1]'</span>,N<span class="str">'datetime'</span>) <span class="kwrd">AS</span> LastCDListChangeDate
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(ProductKey)[1]'</span>,N<span class="str">'int'</span>) <span class="kwrd">AS</span> ProductKey
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(ShortName)[1]'</span>,N<span class="str">'nvarchar(255)'</span>) <span class="kwrd">AS</span> ShortName
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(SubscriptionEndDate)[1]'</span>,N<span class="str">'datetime'</span>) <span class="kwrd">AS</span> SubscriptionEndDate
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(SubscriptionStartDate)[1]'</span>,N<span class="str">'datetime'</span>) <span class="kwrd">AS</span> SubscriptionStartDate
    ,tbl.col.<span class="kwrd">value</span>(N<span class="str">'(InstitutionKey)[1]'</span>,N<span class="str">'int'</span>) <span class="kwrd">AS</span> InstitutionKey
<span class="kwrd">from</span> dbo.EFC_ErrorRows_XML x
<span class="kwrd">cross</span> apply RowData.nodes(N<span class="str">'//Table1'</span>) <span class="kwrd">as</span> tbl(col)
<span class="kwrd">WHERE</span> ErrorSource = <span class="str">'Error_FactEFCTaps_StageTaps_CardKey'</span></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://sqlsolutionsgroup.com/dynamic-ssis-error-logging/">Dynamic SSIS Error Logging</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/dynamic-ssis-error-logging/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Expired Passwords and the Oracle Provider</title>
		<link>https://sqlsolutionsgroup.com/expired-passwords-and-the-oracle-provider/</link>
					<comments>https://sqlsolutionsgroup.com/expired-passwords-and-the-oracle-provider/#comments</comments>
		
		<dc:creator><![CDATA[Randy Knight]]></dc:creator>
		<pubDate>Sat, 15 Jan 2011 12:36:50 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Group]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#microsftcertifedmaster]]></category>
		<category><![CDATA[#microsftpartner]]></category>
		<category><![CDATA[#SQLAB]]></category>
		<category><![CDATA[#SQlatino]]></category>
		<category><![CDATA[#SQlatinoamerica]]></category>
		<category><![CDATA[#sqldatabase]]></category>
		<category><![CDATA[#sqldeveloper]]></category>
		<category><![CDATA[#SQLgroupie]]></category>
		<category><![CDATA[#sqlimer]]></category>
		<category><![CDATA[#sqlimerbymay]]></category>
		<category><![CDATA[#sqlinjection]]></category>
		<category><![CDATA[#sqlinternals]]></category>
		<category><![CDATA[#sqlite]]></category>
		<category><![CDATA[#sqlite3]]></category>
		<category><![CDATA[#SQLLearning]]></category>
		<category><![CDATA[#SQLMagazine]]></category>
		<category><![CDATA[#sqlmanagementstudio]]></category>
		<category><![CDATA[#sqlmanager]]></category>
		<category><![CDATA[#Sqlmap]]></category>
		<category><![CDATA[#sqlrun]]></category>
		<category><![CDATA[#sqlsaturday2017]]></category>
		<category><![CDATA[#sqlsatvienna]]></category>
		<category><![CDATA[#sqlserver]]></category>
		<category><![CDATA[#SQLserver2012]]></category>
		<category><![CDATA[#sqlserver2014]]></category>
		<category><![CDATA[#sqlserver2017]]></category>
		<category><![CDATA[#sqlserver2022]]></category>
		<category><![CDATA[#SQLServeronLinux]]></category>
		<category><![CDATA[#SQLsolutionsgroup]]></category>
		<category><![CDATA[#SQLTraining]]></category>
		<category><![CDATA[#SQLYog]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQLPASS]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[SSG]]></category>
		<category><![CDATA[SSIS]]></category>
		<guid isPermaLink="false">http://www.www.sqlsolutionsgroup.com/blog/index.php/2011/01/expired-passwords-and-the-oracle-provider/</guid>

					<description><![CDATA[<p>I ran into a problem a while back that caused me a lot of grief so I thought I&#8217;d post it here. The package in question was used to traverse hundreds of Oracle databases and run the same query on all of them. This data was then loaded into a data mart. The databases all [&#8230;]</p>
<p>The post <a href="https://sqlsolutionsgroup.com/expired-passwords-and-the-oracle-provider/">Expired Passwords and the Oracle Provider</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I ran into a problem a while back that caused me a lot of grief so I thought I&#8217;d post it here. The package in question was used to traverse hundreds of Oracle databases and run the same query on all of them. This data was then loaded into a data mart. The databases all had an Oracle user on them with a predetermined username and password. It was also in an environment where Oracle Internet Directory (OID) was in use. So it was fairly straightforward to use an SSIS Expression to build the connection string dynamically as the only thing that had to change was the Oracle SID. The connection string looked like this:</p>
<p><span style="font-family: Courier New; font-size: 10pt;">    &#8220;Provider=OraOLEDB.Oracle;User ID=DBUser;Password=DBPassword;Data Source=OracleSID;&#8221;<br />
</span></p>
<p>The package worked flawlessly in development. But when it was deployed to production, it would hang on connections to specific servers. After beating my head against the wall for a while, I discovered that on every server it would fail on, the password was expired for the account. It turns out that by default, the Oracle provider will pop a dialog box for an expired password, prompting a password change. In something batch based like SSIS, this results in the process hanging. Adding a switch to the connection string to suppress the dialog box did the trick.</p>
<p><span style="font-family: Courier New; font-size: 10pt;">    &#8220;Provider=OraOLEDB.Oracle;User ID=DBUser;Password=DBPassword;Data Source=OracleSID;PwdChgDlg=0;&#8221;<br />
</span></p>
<p>This strikes me as something that should default to 0 but in any case it&#8217;s one of those little things that is not a big deal until it happens to you and can be tough to track down.</p>
<p>The post <a href="https://sqlsolutionsgroup.com/expired-passwords-and-the-oracle-provider/">Expired Passwords and the Oracle Provider</a> appeared first on <a href="https://sqlsolutionsgroup.com">SQL Solutions Group</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlsolutionsgroup.com/expired-passwords-and-the-oracle-provider/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
