New expression language functions(Left, Token, TokenCount) in SSIS Denali (SQL Server 2012) CTP 3
In Denali (SQL Server 2012) CTP 3, we have three new functions in the expression language viz. Left , Token and TokenCount so far SSIS is concern
Let us analyze these functions one by one
Left: Returns the left part of a character string with the specified number of characters.This function is already there in TSql for a long time. Also it's counter part Right was already available in SSIS for a long time.
So if we run the below code in the Expression Task, we will get the following output
@[User::Result1] = LEFT("Test for Left function", 4)
//output: Test
The left function in this case strips out the first 4 character from the supplied string
Token: Returns the specified occurrence of a token in a string
So if we run the below code in the Expression Task, we will get the following output
@[User::Result1] = TOKEN("Test for Token Function"," ",2)
//output: for
Because for appeared in the second place
TokenCount: Returns the number of tokens in a string
So if we run the below code in the Expression Task, we will get the following output
@[User::Result2] = TOKENCOUNT("Test for TokenCount function"," ")
//output : 4
Because there are 4 tokens
We can even combine Token and TokenCount as under
@[User::Result1] = TOKEN("Test for Token Function"," ", TOKENCOUNT("Test for TokenCount function"," "))
//output : Function
Because, TokenCount function yields 4 and in the fourth place , we have "Function"
References
Left
Token
Token Count