Guest User

Untitled

a guest
Nov 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. ### SSIS | Generate Datekey (int) from Date field
  2.  
  3. This expression will extract the date from the field <datetime>
  4. in format YYYYMMDD and it will be converted to integer
  5.  
  6. i.e. '2017-01-03 13:18:13.667' --> 20170103 (int)
  7. Just replace <datetime> for your field name
  8.  
  9.  
  10. ```
  11. (DT_I4)((DT_WSTR,4)(DATEPART("yyyy", <datetime>)) +
  12. RIGHT("0" + (DT_WSTR,2)DATEPART("mm", <datetime>), 2) +
  13. RIGHT("0" + (DT_WSTR,2)DATEPART("dd", <datetime>), 2))
  14. ```
Add Comment
Please, Sign In to add comment