<?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>Ralf Eisenreich &#187; ssis</title>
	<atom:link href="http://sqlblog.de/blog/tag/ssis/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlblog.de/blog</link>
	<description>SQLBlog.DE &#124; ..things to remember</description>
	<lastBuildDate>Mon, 09 Apr 2012 07:11:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>SSIS: Execute Package via Stored Procedure</title>
		<link>http://sqlblog.de/blog/2009/09/ssis-execute-package-via-stored-procedure/</link>
		<comments>http://sqlblog.de/blog/2009/09/ssis-execute-package-via-stored-procedure/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 12:42:44 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=671</guid>
		<description><![CDATA[There are two options executing SSIS packages: - xp_cmdshell command (not recommended for security reasons) - sp_start_job command The main...]]></description>
			<content:encoded><![CDATA[<p>There are two options executing SSIS packages:</p>
<p>- <strong>xp_cmdshell</strong> command (not recommended for security reasons)<br />
- <strong>sp_start_job</strong> command</p>
<p>The main difference between both options is the execution method. The xp_cmdshell command is a <em>synchronous</em> call and the sp_start_job command is an <em>asynchronous</em> call.</p>
<p><strong>xp_cmdshell command</strong> (synchronous)</p>
<ul>
<li>enable xp_cmdshell mode in Surface Area Configuration Tool for SQL Server</li>
<li>use following procedure to execute SSIS package:<br />
<code><br />
DECLARE @returncode int<br />
EXEC @returncode = xp_cmdshell 'dtexec /f "<strong>PackageNameWithFullPath</strong>.dtsx"'<br />
</code>
</li>
</ul>
<p><strong>sp_start_job</strong> (asynchronous)</p>
<ul>
<li>define job in SQL Server Agent with SSIS execution step</li>
<li>use following procedure to start SQL Server Agent job with SSIS execution step:<br />
<code><br />
[msdb].dbo.sp_start_job @job_name='<strong>JobName</strong>'<br />
</code>
</li>
<li>check execution status of job, since the call is asynchronous:<br />
<code><br />
SELECT<br />
	[server],<br />
	[start_execution_date],<br />
	[stop_execution_date],<br />
	[run_date],<br />
	[run_duration],<br />
	[run_status],<br />
	[message]<br />
FROM<br />
	MSDB.DBO.SYSJOBS Z<br />
INNER JOIN<br />
	MSDB.DBO.SYSJOBACTIVITY A<br />
	ON Z.JOB_ID = A.JOB_ID<br />
INNER JOIN<br />
	(<br />
	SELECT<br />
		MAX(SESSION_ID) AS SESSION_ID<br />
	FROM<br />
		MSDB.DBO.SYSSESSIONS<br />
	) AS B<br />
	ON	A.SESSION_ID = B.SESSION_ID<br />
LEFT JOIN<br />
	MSDB.DBO.SYSJOBHISTORY C<br />
	ON A.JOB_HISTORY_ID = C.INSTANCE_ID<br />
WHERE<br />
	Z.NAME = '<strong>JobName</strong>'<br />
</code>
</li>
</ul>
<p>There is following way to make the call of sp_start_job synchronous.</p>
<p><strong>sp_start_job</strong> (<strong>synchronous</strong>)</p>
<ul>
<li>define job in SQL Server Agent with SSIS execution step</li>
<li>use following procedure to start SQL Server Agent job with SSIS execution step:<br />
<code><br />
ALTER PROCEDURE [dbo].[AGENT_JOB_CHECK2]<br />
-- Add the parameters for the stored procedure here<br />
DECLARE @job_name nvarchar(100)='',<br />
DECLARE @maxwaitmins int = 5<br />
AS<br />
BEGIN<br />
set NOCOUNT ON;<br />
set XACT_ABORT ON;<br />
    BEGIN TRY<br />
    declare @running as int<br />
    declare @seccount as int<br />
    declare @maxseccount as int<br />
    set @maxseccount = 60*@maxwaitmins<br />
    set @seccount = 0<br />
    set @running = 0<br />
    declare @job_owner sysname<br />
    declare @job_id UNIQUEIDENTIFIER<br />
    set @job_owner = SUSER_SNAME()<br />
    -- get job id<br />
    select @job_id=job_id<br />
    from msdb.dbo.sysjobs sj<br />
    where sj.name=@job_name<br />
    -- invalid job name then exit with an error<br />
    if @job_id is null<br />
        RAISERROR (N'Unknown job: %s.', 16, 1, @job_name)<br />
    -- output from stored procedure xp_sqlagent_enum_jobs is captured in the following table<br />
    declare @xp_results TABLE ( job_id                UNIQUEIDENTIFIER NOT NULL,<br />
                                last_run_date         INT              NOT NULL,<br />
                                last_run_time         INT              NOT NULL,<br />
                                next_run_date         INT              NOT NULL,<br />
                                next_run_time         INT              NOT NULL,<br />
                                next_run_schedule_id  INT              NOT NULL,<br />
                                requested_to_run      INT              NOT NULL, -- BOOL<br />
                                request_source        INT              NOT NULL,<br />
                                request_source_id     sysname          COLLATE database_default NULL,<br />
                                running               INT              NOT NULL, -- BOOL<br />
                                current_step          INT              NOT NULL,<br />
                                current_retry_attempt INT              NOT NULL,<br />
                                job_state             INT              NOT NULL)<br />
    -- start the job<br />
    declare @r as int<br />
    exec @r = msdb..sp_start_job @job_name<br />
    -- quit if unable to start<br />
    if @r<>0<br />
        RAISERROR (N'Could not start job: %s.', 16, 2, @job_name)<br />
    -- start with an initial delay to allow the job to appear in the job list (maybe I am missing something ?)<br />
    WAITFOR DELAY '0:0:10';<br />
    set @seccount = 10<br />
    -- check job run state<br />
    insert into @xp_results<br />
    execute master.dbo.xp_sqlagent_enum_jobs 1, @job_owner, @job_id<br />
    set @running= (SELECT top 1 running from @xp_results)<br />
    while @running<>0 and @seccount < @maxseccount<br />
    begin<br />
        WAITFOR DELAY '0:0:10';<br />
        set @seccount = @seccount + 10<br />
        delete from @xp_results<br />
        insert into @xp_results<br />
        execute master.dbo.xp_sqlagent_enum_jobs 1, @job_owner, @job_id<br />
        set @running= (SELECT top 1 running from @xp_results)<br />
    end<br />
	-- result: query<br />
	SELECT<br />
		[server],<br />
		[start_execution_date],<br />
		[stop_execution_date],<br />
		[run_date],<br />
		[run_duration],<br />
		[run_status],	-- 0: failed, 1: success, null: running<br />
		[message]<br />
	FROM<br />
		MSDB.DBO.SYSJOBS Z<br />
	INNER JOIN<br />
		MSDB.DBO.SYSJOBACTIVITY A<br />
		ON Z.JOB_ID = A.JOB_ID<br />
	INNER JOIN<br />
		(<br />
		SELECT<br />
			MAX(SESSION_ID) AS SESSION_ID<br />
		FROM<br />
			MSDB.DBO.SYSSESSIONS<br />
		) AS B<br />
		ON	A.SESSION_ID = B.SESSION_ID<br />
		LEFT JOIN<br />
		MSDB.DBO.SYSJOBHISTORY C<br />
		ON A.JOB_HISTORY_ID = C.INSTANCE_ID<br />
	WHERE Z.NAME = @job_name<br />
	-- result: not ok (=1) if still running<br />
    --if @running <> 0<br />
        --return 0<br />
    --else<br />
        --return 1<br />
    END TRY<br />
    BEGIN CATCH<br />
    DECLARE<br />
        @ErrorMessage    NVARCHAR(4000),<br />
        @ErrorNumber     INT,<br />
        @ErrorSeverity   INT,<br />
        @ErrorState      INT,<br />
        @ErrorLine       INT,<br />
        @ErrorProcedure  NVARCHAR(200);<br />
    SELECT<br />
        @ErrorNumber = ERROR_NUMBER(),<br />
        @ErrorSeverity = ERROR_SEVERITY(),<br />
        @ErrorState = ERROR_STATE(),<br />
        @ErrorLine = ERROR_LINE(),<br />
        @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-');<br />
    SELECT @ErrorMessage =<br />
        N'Error %d, Level %d, State %d, Procedure %s, Line %d, ' +<br />
            'Message: '+ ERROR_MESSAGE();<br />
    RAISERROR<br />
        (<br />
        @ErrorMessage,<br />
        @ErrorSeverity,<br />
        1,<br />
        @ErrorNumber,    -- original error number.<br />
        @ErrorSeverity,  -- original error severity.<br />
        @ErrorState,     -- original error state.<br />
        @ErrorProcedure, -- original error procedure name.<br />
        @ErrorLine       -- original error line number.<br />
        );<br />
    END CATCH<br />
END<br />
</code>
</li>
</ul>
<p>[Source: <a href="http://blog.boxedbits.com/archives/124">http://blog.boxedbits.com/archives/124</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/09/ssis-execute-package-via-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSIS: SQL Server Agent Job (run packages)</title>
		<link>http://sqlblog.de/blog/2009/07/ssis-sql-server-agent-job-run-packages/</link>
		<comments>http://sqlblog.de/blog/2009/07/ssis-sql-server-agent-job-run-packages/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 11:33:54 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=579</guid>
		<description><![CDATA[If you experience following error &#8220;Executed as user: MyDomain\SQLServer. The package execution failed. The step failed.&#8221; then check that your...]]></description>
			<content:encoded><![CDATA[<p>If you experience following error <em>&#8220;Executed as user: MyDomain\SQLServer. The package execution failed. The step failed.&#8221;</em><br />
then check that your Service User for the SQL Server Agent has full file permissions to all packages, config files and log files!<br />
Moreover this service user should be member of the SQL Server DTS Group.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/07/ssis-sql-server-agent-job-run-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS: Import localized Date columns under different regional settings</title>
		<link>http://sqlblog.de/blog/2009/07/ssis-import-localized-date-columns-under-different-regional-settings/</link>
		<comments>http://sqlblog.de/blog/2009/07/ssis-import-localized-date-columns-under-different-regional-settings/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 12:24:39 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=563</guid>
		<description><![CDATA[Importing Date values e.g. from Flat Files it can happen that the format of the date is different to the...]]></description>
			<content:encoded><![CDATA[<p>Importing Date values e.g. from Flat Files it can happen that the format of the date is different to the Host System date formatting of the regional settings. Especial the date setting for English (UK: day/month/year) and English (US: month/day/year) are often very problematic.</p>
<p>In SSIS a solution for this issue can be realized with a ScriptComponent as follows.</p>
<ol>
<li><strong>Date column</strong><br />
First of all you should import your Date column as nvarchar type. In this example let us assume we are going to import a Birthday column in Germany format on a host system with US-based regional setting.
	</li>
<li><strong>Script Component: Columns</strong><br />
We specify as import column the <em>BIRTHDAY_STR</em> column (nvarchar) from the Flat File and as export column we specify a column of type <em>date</em> named <em>BIRTHDAY_DATE</em>.
</li>
<li><strong>ScriptComponent: Code</strong><br />
In the Script we are using the <em>TryParse</em> method which is stable and flexible enough. But in order to import the German date we have to create a <em>culture</em> object.</p>
<p><code><br />
        Dim dt As DateTime<br />
        Dim culture As Globalization.CultureInfo<br />
        culture = Globalization.CultureInfo.CreateSpecificCulture("de-DE")<br />
        Try<br />
            If DateTime.TryParse(CStr(Row.BIRTHDAY_STR), culture, Globalization.DateTimeStyles.None, dt) Then<br />
                Row.BIRTHDAY_DATE = dt<br />
            Else<br />
                Row.BIRTHDAY_DATE_IsNull = True<br />
            End If<br />
        Catch ex As Exception<br />
            Row.BIRTHDAY_DATE_IsNull = True<br />
        End Try<br />
</code>
</li>
</ol>
<p>This example should help you to import the dates of different regional settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/07/ssis-import-localized-date-columns-under-different-regional-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS: Split Excel cell values into rows</title>
		<link>http://sqlblog.de/blog/2009/04/ssis-split-excel-cell-values-into-rows/</link>
		<comments>http://sqlblog.de/blog/2009/04/ssis-split-excel-cell-values-into-rows/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 14:26:42 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=474</guid>
		<description><![CDATA[Here I would like to show you a solution for following problem. One source row coming from Excel contains several...]]></description>
			<content:encoded><![CDATA[<p>Here I would like to show you a solution for following problem.<br />
One source row coming from Excel contains several values within one column. Each one of these values should be reflected in a separate row in the data destination.<br />
So the basic problem is that there we have a &#8220;list column&#8221; whose contents should be result in separate rows.</p>
<p>To make the problem more complex: The number of values in the &#8220;list column&#8221; is variable and there is a second column which contains corresponding values.</p>
<p><strong>Excel Source</strong><br />
<div id="attachment_481" class="wp-caption aligncenter" style="width: 280px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_sheet.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_sheet.png" alt="Excel Sheet" title="Excel Sheet" width="270" height="165" class="size-full wp-image-481" /></a><p class="wp-caption-text">Excel Sheet</p></div></p>
<p><strong>solution: SSIS Script Component</strong></p>
<p>To implement a solution for the problem we use the most adequate item &#8211; the Script Component.</p>
<ol>
<li> We start with a data flow task in our package and add an <em>OLE DB Excel Source</em> component (that returns the source data above).<br />
We can use following SQL statement:<br />
<code><br />
SELECT<br />
F1,F2,F3<br />
FROM<br />
[sheet1$B1:D5]<br />
</code><br />
The imported columns can be named as <code>KEY</code>, <code>PERSON</code>, <code>DEPARTMENT</code>.<br />
<div id="attachment_507" class="wp-caption aligncenter" style="width: 233px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_source.png"><img class="size-full wp-image-507" title="Excel Source" src="http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_source.png" alt="Excel Source" width="223" height="300" /></a><p class="wp-caption-text">Excel Source</p></div>
	</li>
<li> Then we add a <em>Derived Column</em> Component to the data flow as well.<br />
<div id="attachment_505" class="wp-caption aligncenter" style="width: 160px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column.png" alt="Derived Column" title="Derived Column" width="150" height="131" class="size-full wp-image-505" /></a><p class="wp-caption-text">Derived Column</p></div></p>
<p>In order to replace the CRs with commas we replace the imported columns with following formula:<br />
<code><br />
REPLACE(REPLACE(REPLACE(REPLACE(PERSON,"\n",",")," ",""),",,",","),",,",",")<br />
REPLACE(REPLACE(REPLACE(REPLACE(DEPARTMENT,"\n",",")," ",""),",,",","),",,",",")<br />
</code><br />
<div id="attachment_506" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column_settings.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/derived_column_settings-300x218.png" alt="Derived Column Settings" title="Derived Column Settings" width="300" height="218" class="size-medium wp-image-506" /></a><p class="wp-caption-text">Derived Column Settings</p></div>
	</li>
<li>
As result we receive following list of elements:</p>
<ul>
<li> &#8211; -</li>
<li><em>row 1</em></li>
<li>PERSON: Mr. Wayne,Mr. Kent,Mr. Parker</li>
<li>DEPARTMENT: Heros/Batman,Heros/Superman,Heros/Spiderman</li>
<li> &#8211; -</li>
<li><em>row 2</em></li>
<li>PERSON: Mr. Kirk,Ms. Janeway</li>
<li>DEPARTMENT: StarTrek/Classic,StartTrek/Voyager</li>
<li> &#8211; -</li>
<li><em>row 3</em></li>
<li>PERSON: &#8220;Mr. Wrong&#8221;</li>
<li>DEPARTMENT: Wrong entry 1,Wrong entry 2</li>
<li> &#8211; -</li>
</ul>
</li>
<li> Now we add a Script Component to the data flow.<br />
When we are prompted to select the type of the component we choose <em>Transformation</em>.</p>
<p><div id="attachment_508" class="wp-caption aligncenter" style="width: 168px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component.png" alt="Script Component" title="Script Component" width="158" height="232" class="size-full wp-image-508" /></a><p class="wp-caption-text">Script Component</p></div>
	</li>
<li> Then we right-click on the <em>Script Component</em> and choose Edit. In the Script Transformation Editor dialog box we select all three columns to make them available as input columns. Now these column are available in the Script code.<br />
<div id="attachment_516" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_columns.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_columns-300x260.png" alt="Script Component Columns" title="Script Component Columns" width="300" height="260" class="size-medium wp-image-516" /></a><p class="wp-caption-text">Script Component Columns</p></div>
	</li>
<li> Since the tranformation is going to produce more output rows than it receives input rows we have to mark the transformation as asynchronous. This is done by setting the <em>SynchronousInputID</em> property of the output to <em>None</em>.<br />
<div id="attachment_511" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_settings.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_settings-300x212.png" alt="Script Component Settings" title="Script Component Settings" width="300" height="212" class="size-medium wp-image-511" /></a><p class="wp-caption-text">Script Component Settings</p></div>
	</li>
<li> Next, we have to specify the output columns that the output buffer will contain. So we select the transformation&#8217;s output and click <em>Add Column</em> and set the properties (column name and data type).<br />
<div id="attachment_510" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_input.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_input-300x256.png" alt="Script Component Input / Output rows" title="Script Component Input / Output rows" width="300" height="256" class="size-medium wp-image-510" /></a><p class="wp-caption-text">Script Component Input / Output rows</p></div>
	</li>
<li>
Now we can add the code by clicking on the <em>Design Script button</em>.<br />
<div id="attachment_509" class="wp-caption aligncenter" style="width: 295px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_design.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/script_component_design.png" alt="Script Component - Design Script" title="Script Component - Design Script" width="285" height="183" class="size-full wp-image-509" /></a><p class="wp-caption-text">Script Component - Design Script</p></div>
	</li>
<li>
Following Code is splitting our list of items into rows:<br />
<code><br />
' Variables<br />
Dim i As Integer = 0<br />
Dim itemList_PERSON As String = Row.PERSON<br />
Dim itemList_DEPARTMENT As String = Row.DEPARTMENT<br />
Dim delimiter As String = ','<br />
If Not (String.IsNullOrEmpty(itemList_PERSON) Or String.IsNullOrEmpty(itemList_DEPARTMENT)) Then<br />
Dim inputListArray_Wer() As String = itemList_PERSON.Split(New String() {delimiter}, StringSplitOptions.RemoveEmptyEntries)<br />
Dim inputListArray_Abt() As String = itemList_DEPARTMENT.Split(New String() {delimiter}, StringSplitOptions.RemoveEmptyEntries)<br />
If (inputListArray_Wer.Length = inputListArray_Abt.Length) Then<br />
' new rows<br />
For Each item As String In inputListArray_Wer<br />
With Output0Buffer<br />
.AddRow()<br />
.KEY = CInt(Row.KEY)<br />
.PERSON = item<br />
.DEPARTMENT = inputListArray_Abt(i).ToString()<br />
End With<br />
' increase counter<br />
i = i + 1<br />
Next<br />
Else<br />
' Filtered Rows<br />
With Output1Buffer<br />
.AddRow()<br />
.KEY = CInt(Row.KEY)<br />
.PERSON = Row.PERSON<br />
.DEPARTMENT = Row.DEPARTMENT<br />
End With<br />
End If<br />
End If<br />
</code><br />
The code shows that there are two outputs. Whenever a record set cannot be split or the columns <em>PERSON</em> and <em>DEPARTMENT</em> have a different number of itemss the rows is redirected to the second output (here <em>Output1</em>).
	</li>
<li>
In order to receive the output from the Script Component we add a <em>Union All Component</em>. Additionally we add two <em>Data Viewer Components</em>, since  we want to see the resulting outputs from the Script Component.<br />
<div id="attachment_502" class="wp-caption aligncenter" style="width: 295px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_union_all.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_union_all-285x300.png" alt="Union ALL" title="Union ALL" width="285" height="300" class="size-medium wp-image-502" /></a><p class="wp-caption-text">Union ALL</p></div>
	</li>
<li>
Running the SSIS package will bring the following result.<br />
<div id="attachment_501" class="wp-caption aligncenter" style="width: 290px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_complete.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_flow_complete-280x300.png" alt="Data Flow completed" title="Data Flow completed" width="280" height="300" class="size-medium wp-image-501" /></a><p class="wp-caption-text">Data Flow completed</p></div>
	</li>
<li>
As we can see, the first DataViewer Component show us the <em>valid</em> rows produced by our Script Component.<br />
<div id="attachment_504" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_valid.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_valid-300x120.png" alt="Data Viewer valid rows" title="Data Viewer valid rows" width="300" height="120" class="size-medium wp-image-504" /></a><p class="wp-caption-text">Data Viewer valid rows</p></div>
	</li>
<li>
The second DataViewer Component show us the <em>invalid</em> rows produced by our Script Component.<br />
<div id="attachment_503" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_invalid.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2009/04/data_viewer_invalid-300x35.png" alt="Data Viewer invalid rows" title="Data Viewer invalid rows" width="300" height="35" class="size-medium wp-image-503" /></a><p class="wp-caption-text">Data Viewer invalid rows</p></div>
	</li>
</ol>
<p><strong>download</strong><br />
Of course I provide you the solution as <a href='http://sqlblog.de/blog/wp-content/uploads/2009/04/excel_split_column.zip'>download</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/04/ssis-split-excel-cell-values-into-rows/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SSIS: Excel Import Column Data Types</title>
		<link>http://sqlblog.de/blog/2009/04/ssis-excel-import-column-data-types/</link>
		<comments>http://sqlblog.de/blog/2009/04/ssis-excel-import-column-data-types/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 08:39:59 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=428</guid>
		<description><![CDATA[When Excel data is not coming into SSIS right, then do the following: use option &#8220;IMEX=1&#8221; in ConnectionString (Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\..\MyExcel.xls;Extended...]]></description>
			<content:encoded><![CDATA[<p>When Excel data is not coming into SSIS right, then do the following:</p>
<ol>
<li>use option &#8220;<code>IMEX=1</code>&#8221; in ConnectionString (<code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\..\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"</code>)</li>
<li>modify registry setting &#8220;<code>TypeGuessRows=8</code>&#8221; to a much higher value</li>
<li>use a sql statement to retrieve data (e.g. &#8220;<code>SELECT * FROM [sheet1$A5:M2000]</code>&#8220;)</li>
</ol>
<p>NOTE: The setting <code>IMEX=1</code> tells the Excel driver to use <em>Import</em> mode. This mode reads the registry setting &#8220;<code>ImportMixedTypes=Text</code>&#8221; which forces mixed data to be converted to text. To achieve a more reliable column type recognition, the registry setting &#8220;<code>TypeGuessRows=8</code>&#8221; should be increased. By default the ISAM driver analyzes  the first eight rows and determines the column datatypes from this sampling. If the first analysed rows contain only numeric values, then setting <code>IMEX=1</code> will not convert this column datatype to Text &#8211; it will remain numeric.</p>
<p>ATTENTION: The IMEX setting has some other modes:</p>
<ul>
<li>0 is Export mode</li>
<li>1 is Import mode</li>
<li>2 is Linked mode (full update capabilities)</li>
</ul>
<p>Registry Setting Location:<br />
<code><br />
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\X.X\Engines\Excel<br />
</code></p>
<p><strong>supplement</strong><br />
If you experience following error the above described solution could fix it.<br />
1. An OLE DB error has occurred. Error code: 0x80040E21.<br />
2. Failed to retrieve long data for column &#8220;XYZ&#8221;.<br />
3. There was an error with output column &#8220;XYZ&#8221; (55488) on output &#8220;Excel Source Output&#8221; (109). The column status returned was: &#8220;DBSTATUS_UNAVAILABLE&#8221;.<br />
4. The &#8220;output column &#8220;XYZ&#8221;  (55488)&#8221; failed because error code 0xC0209071 occurred, and the error row disposition on &#8220;output column &#8220;XYZ&#8221; (55488)&#8221; specifies failure on error. An error occurred on the specified object of the specified component.<br />
5. [DTS.Pipeline] Error: The PrimeOutput method on component &#8220;Info Source&#8221; (101) returned error code 0xC0209029.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.<br />
6. [DTS.Pipeline] Error: Thread &#8220;SourceThread0&#8243; has exited with error code 0xC0047038. </p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/04/ssis-excel-import-column-data-types/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Initiate SSIS packages from ASP.NET Web Applications</title>
		<link>http://sqlblog.de/blog/2007/06/initiate-ssis-packages-from-aspnet-web-applications/</link>
		<comments>http://sqlblog.de/blog/2007/06/initiate-ssis-packages-from-aspnet-web-applications/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 08:59:41 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/index.php/2007/06/18/initiate-ssis-packages-from-aspnet-web-applications/</guid>
		<description><![CDATA[In order to start SSIS packages from ASP.NET web applications you can use a Web Service. Following page shows how...]]></description>
			<content:encoded><![CDATA[<p>In order to start SSIS packages from ASP.NET web applications you can use a Web Service.</p>
<p>Following page shows how to implement this: <a href="http://msdn2.microsoft.com/de-de/library/ms403355.aspx#service" title="SSIS from ASP.NET">Running packages programmatically on the server by using a Web service or remote component</a><span id="_ctl0_MainContent_PostFlatView"></span><span></span>.<br />
What you should know about running SSIS packages from ASP.NET is that there is a problem with the threads SSIS processes use.</p>
<p>Even <a href="http://msdn2.microsoft.com/en-us/library/xh507fc5(VS.71).aspx" title="Impersonation">Impersonation</a> does not work successfully. The impersonation applies to the calling thread only, but SSIS creates additional threads in order to be able to perform multiple steps simultanously. Unfortunately, the impersonation context is not passed to these additional threads, so any data base access occurs under process user context, not under impersonated context.</p>
<p>So it is better to execute SSIS package outside of ASP.NET process, e.g. using DTEXEC or Agent Job (Agent proxies are convinient if you want to execute under specific credentials).</p>
<p><u>Important</u>:<br />
With its default settings for authentication and authorization, a Web service generally does not have sufficient permissions to access SQL Server or the file system to load and execute packages. You may have to assign appropriate permissions to the Web service by configuring its authentication and authorization settings in the web.config file and assigning database and file system permissions as appropriate.</p>
<p><strong>Solution</strong>:</p>
<p><u>IIS 5.0</u>: only solution seems to be assigning Administrator rights to the ASP.NET User</p>
<p><u>IIS 6.0</u>: create new Application Pool with Administrator user context and set the Web Service<br />
using this context in order to initiate SSIS packages</p>
<p>Here is an example Application Configuration for a SSIS &amp; ASP.NET project:</p>
<p><a href="http://sqlblog.de/blog/wp-content/uploads/2007/06/ssis_aspnet.jpg" title="SSIS ASP.NET"><img src="http://sqlblog.de/blog/wp-content/uploads/2007/06/ssis_aspnet.thumbnail.jpg" alt="SSIS ASP.NET" /></a></p>
<p>Following error messages can show that you&#8217;re running into the problem with the SSIS threads:<br />
- package validation failed<br />
- TaskHost validation failed<br />
- cannot access file location<br />
- component xyz validation failed</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2007/06/initiate-ssis-packages-from-aspnet-web-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS: Excel import presents numeric values as NULL</title>
		<link>http://sqlblog.de/blog/2007/05/ssis-excel-import-presents-numeric-values-as-null/</link>
		<comments>http://sqlblog.de/blog/2007/05/ssis-excel-import-presents-numeric-values-as-null/#comments</comments>
		<pubDate>Wed, 16 May 2007 09:41:52 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/index.php/2007/05/16/ssis-excel-import-presents-numeric-values-as-null/</guid>
		<description><![CDATA[Falls aus Excel Daten importiert werden die sowohl textuell als auch numerisch sein können (pro Spalte), dann kann es passieren,...]]></description>
			<content:encoded><![CDATA[<p>Falls aus Excel Daten importiert werden die sowohl textuell als auch numerisch sein können (pro Spalte), dann kann es passieren, dass numerische Werte als NULL-Values dargestellt werden.</p>
<p>Lösung:<br />
Einfach bei Extended Connection Properties (des Excel Connection Managers) &#8220;IMEX=1&#8243; (für import-Mode) anfügen.</p>
<p>[Quelle: <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;194124">http://support.microsoft.com/default.aspx?scid=kb;EN-US;194124</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2007/05/ssis-excel-import-presents-numeric-values-as-null/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS: Package import error</title>
		<link>http://sqlblog.de/blog/2006/11/ssis-package-import-error/</link>
		<comments>http://sqlblog.de/blog/2006/11/ssis-package-import-error/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 11:00:19 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/16/ssis-package-import-error/</guid>
		<description><![CDATA[Falls ein Fehler beim Importieren von SSIS-Paketen auftritt und der SQL Server nicht unter der Default-Instanz installiert ist, liegt das...]]></description>
			<content:encoded><![CDATA[<p>Falls ein Fehler beim Importieren von SSIS-Paketen auftritt und der SQL Server nicht unter der Default-Instanz installiert ist, liegt das mit hoher Sicherheit an einem Konfigurationsfehler.</p>
<p>In der Datei steht standardmäßig der Eintrag <code>.</code>, welcher in <code>SERVER\instance</code> geändert werden muss.</p>
<p>Dann findet der Integration Service auch die richtige SQL-Instanz zum speichern von Paketen.</p>
<p>Die Datei befindet sich unter <code>C:\Program Files\Microsoft SQL Server\90\DTS\Binn</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/ssis-package-import-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSIS: Fehlstart nach SP1</title>
		<link>http://sqlblog.de/blog/2006/11/ssis-fehlstart-nach-sp1/</link>
		<comments>http://sqlblog.de/blog/2006/11/ssis-fehlstart-nach-sp1/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 07:25:53 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[sp1]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/16/ssis-fehlstart-nach-sp1/</guid>
		<description><![CDATA[error 1053 integration services Falls ein Fehlstart der SSIS nach der Installation des Service Pack 1 für den SQL-Server auftritt,...]]></description>
			<content:encoded><![CDATA[<p><strong>error 1053 integration services</strong></p>
<p>Falls ein Fehlstart der SSIS nach der Installation des Service Pack 1 für den SQL-Server auftritt, dann kann es daran liegen, dass der direkte Internetzugang geblockt wird.</p>
<p>Entweder Firewall konfigurieren oder dem System die aktuellen Proxy-Einstellungen mitteilen.</p>
<p>Den Proxy konfiguriert man dann in der Eingabeaufforderung mit dem Tool <code>proxycfg.exe</code>.</p>
<p>[Quelle: <a href="http://support.microsoft.com/kb/918644">MS Knowledge</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/ssis-fehlstart-nach-sp1/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>SSIS: Paket aus .NET starten</title>
		<link>http://sqlblog.de/blog/2006/11/ssis-paket-aus-net-starten/</link>
		<comments>http://sqlblog.de/blog/2006/11/ssis-paket-aus-net-starten/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 10:12:15 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/11/14/ssis-paket-aus-net-starten/</guid>
		<description><![CDATA[Um ein SSIS-Paket, dass im SSIS-Storage des SQL-Servers (nicht im FileSystem) abgelegt ist aus einer .NET-Anwendung zu starten kann folgender...]]></description>
			<content:encoded><![CDATA[<p>Um ein SSIS-Paket, dass im SSIS-Storage des SQL-Servers (nicht im FileSystem) abgelegt ist aus einer .NET-Anwendung zu starten kann folgender Code verwendet werden:</p>
<p><span id="more-144"></span></p>
<div class="igBar"><span id="lvb-2"><a href="#" onclick="javascript:showPlainTxt('vb-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-2">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Protected <span style="color: #b1b100;">Sub</span> btnStart_Click<span style="color:#006600; font-weight:bold;">&#40;</span>ByVal sender <span style="color: #b1b100;">As</span> Object, ByVal e <span style="color: #b1b100;">As</span> System.<span style="color: #66cc66;">EventArgs</span><span style="color:#006600; font-weight:bold;">&#41;</span> Handles btnStart.<span style="color: #66cc66;">Click</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> pkg <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">New</span> Package</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> app <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">New</span> Application</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">Dim</span> pkgResults <span style="color: #b1b100;">As</span> DTSExecResult</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; pkg = app.<span style="color: #66cc66;">LoadFromSqlServer</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"\\PAKET_NAME"</span>, <span style="color: #ff0000;">"SERVER_NAME"</span>, <span style="color: #ff0000;">"USER"</span>, <span style="color: #ff0000;">"PASSWORD"</span>, <span style="color: #b1b100;">Nothing</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; pkgResults = pkg.<span style="color: #66cc66;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Console.<span style="color: #66cc66;">WriteLine</span><span style="color:#006600; font-weight:bold;">&#40;</span>pkgResults<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Achtung: Die Referenz <code>Imports Microsoft.SqlServer.Dts.Runtime</code> muss hinzugefÃ¼gt werden!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/11/ssis-paket-aus-net-starten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server: Integration Services</title>
		<link>http://sqlblog.de/blog/2006/04/sql-server-integration-services/</link>
		<comments>http://sqlblog.de/blog/2006/04/sql-server-integration-services/#comments</comments>
		<pubDate>Sun, 09 Apr 2006 13:08:18 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[ssis]]></category>

		<guid isPermaLink="false">http://ralf-eisenreich.de/blog/index.php/2006/04/09/sql-server-integration-services/</guid>
		<description><![CDATA[Die SQL Server Integration Services erlauben das Zusammenfuehren von Daten aus heterogenen Datenquellen. Um den Ueberblick zu behalten wird der...]]></description>
			<content:encoded><![CDATA[<p>Die SQL Server Integration Services erlauben das Zusammenfuehren von Daten aus heterogenen Datenquellen. Um den Ueberblick zu behalten wird der gesamte Datenfluss grafisch dargestellt und modelliert.</p>
<p>Das finde ich klasse, denn gerade wenn man ein Projekt an eine weitere Person uebergeben muss oder selbst an mehreren Projekten arbeitet, behaelt man durch diese kleine Hilfe den Ueberblick besser.</p>
<p><a class="imagelink" title="SQL Server Integration Services" href="http://ralf-eisenreich.de/blog/wp-content/uploads/2006/04/sql_server_integration_services.jpg"><img id="image40" alt="SQL Server Integration Services" src="http://ralf-eisenreich.de/blog/wp-content/uploads/2006/04/sql_server_integration_services.thumbnail.jpg" /></a></p>
<p>An manchen Stellen wird es trotzdem notwendig sein, Programmierfaehigkeiten mitzubringen. Dazu kann dann die Scriptkomponente benutzt werden. Mit folgendem Script kann man auf die Datenquellen in seinem Projekt zugreifen. Aber Achtung es muss eine <em>OLEDB</em>-Verbindung definiert werden!</p>
<p><code><br />
' initialize connection<br />
Me.myConnection = DirectCast(Dts.Connections("SERVER.Database.root.ADO").AcquireConnection(Dts.Transaction), SqlClient.SqlConnection)<br />
' -- open connection to database --<br />
Try<br />
If Not (myConnection.State.Open = ConnectionState.Open) Then<br />
myConnection.Open()<br />
End If<br />
Catch ex As Exception<br />
MsgBox("Could not open connection to DataBase: " &#038; ex.Message.ToString)<br />
End Try<br />
' -- define data tables --<br />
Dim tblTabelle As New Data.DataTable<br />
' -- define SQL-commands --<br />
Dim cmdSQLTblTabelle As New SqlClient.SqlCommand<br />
cmdSQLTblTabelle.CommandText = "SELECT * FROM tblTabelle;"<br />
cmdSQLTblTabelle.Connection() = myConnection<br />
' -- define DataAdapters --<br />
Dim myDATblTabelle As SqlClient.SqlDataAdapter(cmdSQLTblTabelle)<br />
' -- get data from tables --<br />
myDATblTabelle.FillSchema(tblTabelle, SchemaType.Mapped)<br />
myDATblTabelle.Fill(tblTabelle)<br />
' generate InsertCommand automatically with Commandbuilder<br />
Dim myCommandBuilder As New SqlClient.SqlCommandBuilder(myDATblTabelle)<br />
' show rows of query<br />
msgbox("rows: " &#038; tblTabelle.Rows.Count)<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2006/04/sql-server-integration-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

