下面,列出一些实用的表达式:
1,路径取文件名
1 RIGHT([FilePath],FINDSTRING(REVERSE([FilePath]),"\\",1) - 1)
2 RIGHT(@[User::FilePath],FINDSTRING(REVERSE(@[User::FilePath]),"\\",1) - 1)
2,空字符设置默认值
3,数字
例如:123 变 00123
1 RIGHT(("00000" + [STRING_COLUMN]), 5)
2 REPLICATE("0", 5 - LEN([STRING_COLUMN])) + [STRING_COLUMN]
4,日期
1 (DT_DATE)(DT_DBDATE)@[User::datetimeVariable] 2 (DT_DATE)(DT_DBDATE)[datetimeColumn] 3 (DT_DBTIMESTAMP)(DT_DBDATE)GETDATE()
日期转化成字符串
1 (DT_WSTR, 20)YEAR( GETDATE()] )+RIGHT("0"+(DT_WSTR, 20)MONTH( GETDATE()) , 2 )+ RIGHT("0"+(DT_WSTR, 20)DAY( GETDATE() ) , 2 )
5,时间
1 (DT_STR,8,1252)(DT_DBTIME)@[User::datetimeVariable]
2 (DT_STR,8,1252)(DT_DBTIME)[datetimeColumn]
3 (DT_STR,8,1252)(DT_DBTIME)GETDATE()
6,当前月第一天
1 DATEADD("d", -DAY(GETDATE()) + 1, GETDATE())
2 (DT_DBTIMESTAMP)(DT_DBDATE)DATEADD("d", -DAY(GETDATE()) + 1, GETDATE())
7,当前月最后一天
1 DATEADD("d", -DAY(GETDATE()), DATEADD("m", 1, GETDATE()))
2 DT_DBTIMESTAMP)(DT_DBDATE)DATEADD("d", -DAY(GETDATE()), DATEADD("m", 1, GETDATE()))
8,最后一秒
1 DATEADD("s", -1,DATEADD("d", -DAY(GETDATE()) + 1, DATEADD("m", 1, (DT_DBTIMESTAMP)(DT_DBDATE)GETDATE())))