Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Tim Mitchell

Tim Mitchell is a Microsoft SQL Server consultant, speaker, and trainer, and is a Microsoft SQL Server MVP. He has been working with SQL Server for over 7 years, working primarily in business intelligence, ETL/SSIS, reporting, and database development. You can find his complete profile at TimMitchell.net.

LEFT(), or Left Out?

So the question came up earlier today about the RIGHT() and LEFT() functions in the SSIS expression language.  Like the Transact-SQL functions, one might assume that these functions would exist in SSIS expression language to snatch a specified subset of a string.  That assumption would be only half right.

Don’t go digging for a LEFT() function in the expression language, because it ain’t there.  The RIGHT() function does indeed retrieve a specified number of characters, but strangely enough, there’s no corresponding LEFT() function:

left

 

Even though this is a pain for those just learning the expression language syntax, there are a couple of easy workarounds: One could simply use the SUBSTRING() function, with the second parameter – the starting point in the string – set to 1, which yields the same result.  If you want to get really crafty, you could use the RIGHT() combined with the REVERSE() function to simulate the behavior expected.

There’s already a Microsoft Connect item for this issue, and it’s planned to be fixed in a future version.

Comments

Posted by Steve Jones on 14 January 2010

Another oversight in the expression language. Post the Connect link and I'll vote for it.

Leave a Comment

Please register or log in to leave a comment.