Solved

date conversion in SSIS package

Posted on 2011-03-25
5
570 Views
Last Modified: 2012-05-11
Dear Experts,
I have a file that was originally coming through with date formats as (mm/dd/yyyy) vs. the new format (yyyymmddhhmmss???). I have attached the new file. Can you please suggest how I can change the date format to the new format.
Please find attached the picture of the flow that I was using for the old file with date formats as (mm/dd/yyyy) . Please let me know how I can change the date format, should I add a derived column and then change the field types?
Thanks!! main_flow data_conversionSERIAL-DAILY.txt
0
Comment
Question by:sqlcurious
  • 4
5 Comments
 
LVL 15

Assisted Solution

by:Aaron Shilo
Aaron Shilo earned 500 total points
ID: 35221439
hi

make it simple add a derived column and CAST to the needed format.
0
 

Assisted Solution

by:sqlcurious
sqlcurious earned 0 total points
ID: 35223759
Hi tried this, but it is giving an error
(DT_DBTIMESTAMP)(SUBSTRING(IntervalStartDateTime,5,2) + "-" + SUBSTRING(IntervalStartDateTime,7,2) + "-" + SUBSTRING(IntervalStartDateTime,1,4) + " " + SUBSTRING(IntervalStartDateTime,9,2) + ":" + SUBSTRING(IntervalStartDateTime,11,2) + ":00")


0
 

Accepted Solution

by:
sqlcurious earned 0 total points
ID: 35233694
shamu....this should work...

(DT_DBTIMESTAMP)(SUBSTRING([SHIP DATE],1,4) + "-" + SUBSTRING([SHIP DATE],5,2) + "-" + SUBSTRING([SHIP DATE],7,2) + " " + SUBSTRING([SHIP DATE],9,2) + ":" + SUBSTRING([SHIP DATE],11,2) + ":" + SUBSTRING([SHIP DATE],13,2) + "." + SUBSTRING([SHIP DATE],5,3))
0
 

Author Comment

by:sqlcurious
ID: 35233703
And there is one record in your text file with BPRA# 5045105 which has null return date and null shipdate….so that record will fail in the derivedcolumn transformation…so try to redirect that record to the error text file….hope this helps….
0
 

Author Closing Comment

by:sqlcurious
ID: 35304297
problem solved
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now