SSIS - CODEPOINT Function

CODEPOINT :

                         Returns the Unicode code point of the leftmost character of a character expression.


Syntax :

CODEPOINT(character_expression)
 
  • character_expression must have the DT_WSTR data type.
  • CODEPOINT returns a null result if character_expression is null or an empty string.


EXAMPLE : 

Sample data:

CREATE TABLE TEST123(ID INT IDENTITY(1,1),Column1 VARCHAR(40))
INSERT TEST123 (Column1) SELECT 'A12345678'
INSERT TEST123 (Column1) SELECT 'B12345678'
INSERT TEST123 (Column1) SELECT '123456789'

Scenario:

In the above sample data,if we are required to export only the rows with starting character as alphabet in the Column -  Column1.

If we are required to achieve the above scenario using SSIS ,  CODEPOINT function can be used .

 Use this expression in the Conditional Split Task as shown in below images :

     CODEPOINT(UPPER(Column1)) >= 65 && 
   CODEPOINT(UPPER(Column1)) <= 90






 

No comments: