Skip to content

Instantly share code, notes, and snippets.

@belenaj
Last active August 3, 2018 11:49
Show Gist options
  • Save belenaj/e58722d70a829fcbbe049aea88998023 to your computer and use it in GitHub Desktop.
Save belenaj/e58722d70a829fcbbe049aea88998023 to your computer and use it in GitHub Desktop.
SSIS Utilities

SSIS | Extract substring from URL

Looks for the last delimiter "/" and takes the Substring after the last appearance

With @[User::URL] = "https://gist.github.com/belenaj" it will return: belenaj

TOKEN (@[User::URL] , "/", TOKENCOUNT(@[User::URL] , "/"))

SSIS | Generate Datekey (int) from Date field

This expression will extract the date from the field in format YYYYMMDD and it will be converted to integer

i.e. '2017-01-03 13:18:13.667' --> 20170103 (int) Just replace for your field name

(DT_I4)((DT_WSTR,4)(DATEPART("yyyy", <datetime>)) + 
RIGHT("0" + (DT_WSTR,2)DATEPART("mm", <datetime>), 2) + 
RIGHT("0" + (DT_WSTR,2)DATEPART("dd", <datetime>), 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment