简体   繁体   English

ssis派生列格式

[英]ssis derived column format

in ssis I'm loading a data file that has a date field formatted as 11171977 into a table with a data type of varchar(8). 在论文中,我正在将一个具有日期字段格式为11171977的数据文件加载到数据类型为varchar(8)的表中。

i can load this into the table fine; 我可以把它装到桌子上。 however, I need to reformat the data as yyyymmdd so it is 19771117. 但是,我需要将数据重新格式化为yyyymmdd,这样它应该是19771117。

my first attempt was to load as is then query with the following convert: 我的第一次尝试是按原样加载,然后使用以下转换查询:

convert(varchar(8),convert(date,substring (BirthDate,1,2)+'/'+substring (BirthDate,3,2)+'/'+substring (BirthDate,5,4),101), 112)

that gives me yyyymmdd = 19771117. 这使我yyyymmdd = 19771117。

however, I tried to do a derived column with no luck as it didn't like my expression. 但是,我尝试做一个派生列时没有运气,因为它不喜欢我的表情。

how do i do this in an expression in the derived column? 如何在派生列的表达式中执行此操作?

尝试这样的事情:

right(BirthDate,4)+left(BirthDate,4)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM