﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server 2005 Integration Services  / Incorrect concatenation in SSIS expression. What could be wrong? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 01:21:36 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Incorrect concatenation in SSIS expression. What could be wrong?</title><link>http://www.sqlservercentral.com/Forums/Topic1374110-148-1.aspx</link><description>Cross post.  See:[url=http://www.sqlservercentral.com/Forums/Topic1374114-364-1.aspx]http://www.sqlservercentral.com/Forums/Topic1374114-364-1.aspx[/url]</description><pubDate>Thu, 18 Oct 2012 12:24:15 GMT</pubDate><dc:creator>kl25</dc:creator></item><item><title>Incorrect concatenation in SSIS expression. What could be wrong?</title><link>http://www.sqlservercentral.com/Forums/Topic1374110-148-1.aspx</link><description>I have this SSIS expression and it is evaluated as below with the default values replacing the SSIS variables. This is the raw expression:"Select "+(DT_STR, 20, 1252)@[User::BatchID]+ " as BatchID, '" +@[User::BatchDateISO]+ "' as BatchDateISO, 'FH' as RecordType, 'AS400' as SourceSystem, CASE WHEN LEN("+(DT_STR, 10, 1252)@[User::FileLoadNumber]+") = CAST(1 as VARCHAR) THEN '0'+'"+ (DT_STR, 10, 1252) @[User::FileLoadNumber]+"'+'"+@[User::BatchDateISO]+"' ELSE '"+ (DT_STR, 10, 1252) @[User::FileLoadNumber]+"'+'"+@[User::BatchDateISO]+"' END as FileLoadNumber" It is evaluated as:Select 9 as BatchID, '20121017' as BatchDateISO, 'FH' as RecordType, 'AS400' as SourceSystem, CASE WHEN LEN(9) = CAST(1 as VARCHAR) THEN '0'+'9'+'20121017' ELSE '9'+'20121017' END as FileLoadNumberIf the BatchID value is of single digit it has to concatenate with BatchDateISO by appending 0 in front of BatchIDIf BatchID is 9, then the result should be 0920121017 for FileLoadNumber columnIf it is 19, then the result should be 1920121017 for FileLoadNumber columnThanks a lot!</description><pubDate>Wed, 17 Oct 2012 20:00:54 GMT</pubDate><dc:creator>Learner093</dc:creator></item></channel></rss>