Reputation: 21
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).
i can load this into the table fine; however, I need to reformat the data as yyyymmdd so it is 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.
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?
Upvotes: 1
Views: 251
Reputation: 2760
Try something like this:
right(BirthDate,4)+left(BirthDate,4)
Upvotes: 2