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 business intelligence consultant, author, trainer, and SQL Server MVP with over a decade of experience. Tim is the principal of Tyleris Data Solutions and is a Linchpin People teammate. Tim has spoken at international, regional, and local venues including the SQL PASS Summit, SQLBits, SQL Connections, SQL Saturday events, and various user groups and webcasts. He is a board member at the North Texas SQL Server User Group in the Dallas area. Tim is coauthor of the book SSIS Design Patterns, and is a contributing author on MVP Deep Dives 2. You can visit his website and blog at TimMitchell.net or follow him on Twitter at twitter.com/Tim_Mitchell.

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.