<?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; Uncategorized</title>
	<atom:link href="http://sqlblog.de/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlblog.de/blog</link>
	<description>SQLBlog.DE &#124; ..things to remember</description>
	<lastBuildDate>Tue, 24 Nov 2009 16:18:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<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 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. In SSIS a solution for this issue can be realized with [...]]]></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>84</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 values within one column. Each one of these values should be reflected in a separate row in the data destination. So the basic problem is that there we have a &#8220;list column&#8221; whose contents should [...]]]></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>19</slash:comments>
		</item>
		<item>
		<title>SQL Server: Version, Service Pack, Edition</title>
		<link>http://sqlblog.de/blog/2009/03/sql-server-version-service-pack/</link>
		<comments>http://sqlblog.de/blog/2009/03/sql-server-version-service-pack/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 08:59:06 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=413</guid>
		<description><![CDATA[SQL Server: Version, Service Pack, Edition Just run following command within Management Studio: SELECT @@VERSION, SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition') As result you receive something like: Microsoft SQL Server 2005 - ... Windows NT 5.2 (Build 3790: SP 2) 9.00.4035.00 SP3 Standard Edition (64-bit)]]></description>
			<content:encoded><![CDATA[<p><strong>SQL Server: Version, Service Pack, Edition</strong></p>
<p>Just run following command within Management Studio:<br />
<code>SELECT<br />
 @@VERSION,<br />
 SERVERPROPERTY('productversion'),<br />
 SERVERPROPERTY ('productlevel'),<br />
 SERVERPROPERTY ('edition')</code></p>
<p>As result you receive something like:</p>
<pre class="code">Microsoft SQL Server 2005 - ... Windows NT 5.2 (Build 3790: SP 2)
  9.00.4035.00
  SP3
  Standard Edition (64-bit)</pre>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2009/03/sql-server-version-service-pack/feed/</wfw:commentRss>
		<slash:comments>813</slash:comments>
		</item>
		<item>
		<title>SSRS: Disable Reporting Services Cache in Preview Mode</title>
		<link>http://sqlblog.de/blog/2008/12/ssrs-disable-reporting-services-cache-in-preview-mode/</link>
		<comments>http://sqlblog.de/blog/2008/12/ssrs-disable-reporting-services-cache-in-preview-mode/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 14:40:21 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ssrs]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=382</guid>
		<description><![CDATA[How to disable caching in SQL Server Reporting Services for Visual Studio in Preview Mode? SQL Server 2005 Service Pack 1 brings a new feature: caching data in BIDS (Business Intelligence Development Studio) Report Designer. Following objects are cached: all the data query, parameter value and credentials for previewing a report. Sometimes this feature can [...]]]></description>
			<content:encoded><![CDATA[<p>How to disable caching in SQL Server Reporting Services for Visual Studio in Preview Mode?</p>
<p>SQL Server 2005 Service Pack 1 brings a new feature: caching data in BIDS (Business Intelligence Development Studio) Report Designer. Following objects are cached: all the data query, parameter value and  credentials for previewing a report. Sometimes this feature can be annoying, if changes in preview mode should be visible immediately.</p>
<p>In order to disable the caching feature, following key has to be added to the config file &#8216;<code>RSReportDesigner.config</code>&#8216;.</p>
<p>Key:<br />
<code>&lt;Add Key="CacheDataForPreview" value="False" /&gt;</code></p>
<p>Location:<br />
<code>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\RSReportDesigner.config</code><br />
To clear the cache you can also delete the *.data cache file which is located in the report RDL directory.</p>
<div id="attachment_383" class="wp-caption alignnone" style="width: 164px"><img class="size-full wp-image-383" title="ssrs_data_files" src="http://sqlblog.de/blog/wp-content/uploads/2008/12/ssrs_data_files.png" alt="SSRS: Caching Files (Preview Mode)" width="154" height="146" /><p class="wp-caption-text">SSRS: Caching Files (Preview Mode)</p></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2008/12/ssrs-disable-reporting-services-cache-in-preview-mode/feed/</wfw:commentRss>
		<slash:comments>276</slash:comments>
		</item>
		<item>
		<title>Fahrschule Eisenreich</title>
		<link>http://sqlblog.de/blog/2008/08/fahrschule-eisenreich/</link>
		<comments>http://sqlblog.de/blog/2008/08/fahrschule-eisenreich/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 18:36:55 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=279</guid>
		<description><![CDATA[Seit heute ist Fahrschule-Eisenreich.de unter einem neuen Internetauftritt erreichbar.]]></description>
			<content:encoded><![CDATA[<p>Seit heute ist <a href="http://fahrschule-eisenreich.de">Fahrschule-Eisenreich.de</a> unter einem neuen Internetauftritt erreichbar.</p>
<div id="attachment_280" class="wp-caption alignnone" style="width: 268px"><a href="http://sqlblog.de/blog/wp-content/uploads/2008/08/screenshot_fahrschule.png"><img src="http://sqlblog.de/blog/wp-content/uploads/2008/08/screenshot_fahrschule-258x300.png" alt="Screenshot: fahrschule-eisenreich.de" title="Screenshot: fahrschule-eisenreich.de" width="258" height="300" class="size-medium wp-image-280" /></a><p class="wp-caption-text">Screenshot: fahrschule-eisenreich.de</p></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2008/08/fahrschule-eisenreich/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Terminals: RDP-Sessions verwalten</title>
		<link>http://sqlblog.de/blog/2008/08/terminals-rdp-sessions-verwalten/</link>
		<comments>http://sqlblog.de/blog/2008/08/terminals-rdp-sessions-verwalten/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 07:36:50 +0000</pubDate>
		<dc:creator>Ralf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqlblog.de/blog/?p=266</guid>
		<description><![CDATA[Auf Codeplex gibt es die OpenSource-Software Terminals. Mit Terminals lassen sich mehrere Remote Desktop Sessions verwalten. Terminals is a secure, multi tab terminal services/remote desktop client.]]></description>
			<content:encoded><![CDATA[<p>Auf <a href="http://www.codeplex.com">Codeplex</a> gibt es die OpenSource-Software <a href="http://www.codeplex.com/Terminals">Terminals</a>. Mit Terminals lassen sich mehrere Remote Desktop Sessions verwalten.</p>
<blockquote><p>
Terminals is a secure, multi tab terminal services/remote desktop client.
</p></blockquote>
<div id="attachment_267" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlblog.de/blog/wp-content/uploads/2008/08/terminals.jpg"><img src="http://sqlblog.de/blog/wp-content/uploads/2008/08/terminals-300x185.jpg" alt="RDP Management" title="Terminals" width="300" height="185" class="size-medium wp-image-267" /></a><p class="wp-caption-text">RDP Management</p></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlblog.de/blog/2008/08/terminals-rdp-sessions-verwalten/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
