x
login about faq Site discussion (meta-askssc)

ssis convert dd/mm/yyyy yyyymmdd

Hi title is pretty self explanatory! What's the best way of doing this in SSIS? I looked at data conversion but seems like it will only handle dd-mm-yyyy not with forward slashes?

more ▼

asked May 17 '12 at 12:49 PM in Default

jhowe gravatar image

jhowe
919 29 42 46

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Yes that is pretty similar to what i came up with, whack this in a derived column transform

TRIM(DateOfBirth) == "" ? NULL(DT_WSTR,1) : TRIM(SUBSTRING(DateOfBirth,7,4) + SUBSTRING(DateOfBirth,4,2) + SUBSTRING(DateOfBirth,1,2))
more ▼

answered May 17 '12 at 02:26 PM

jhowe gravatar image

jhowe
919 29 42 46

(comments are locked)
10|1200 characters needed characters left

You can use SUBSTRING for that

SUBSTRING(datetimecol, 7,4)+ SUBSTRING(datetimecol, 3,2) + SUBSTRING(datetimecol, 1,2)

more ▼

answered May 17 '12 at 01:48 PM

robbin gravatar image

robbin
1.6k 1 3 5

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1832
x749

asked: May 17 '12 at 12:49 PM

Seen: 561 times

Last Updated: May 17 '12 at 02:26 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.