SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

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:



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.

Tim Mitchell

Tim Mitchell is a business intelligence consultant, author, trainer, and Microsoft Data Platform MVP with over thirteen years of data management experience. He is the founder and principal of Tyleris Data Solutions.

Tim has spoken at international and local events including the SQL PASS Summit, SQLBits, SQL Connections, along with dozens of tech fests, code camps, and SQL Saturday events. He 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 @Tim_Mitchell.


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.