?
Solved

date conversion in SSIS package

Posted on 2011-03-25
5
Medium Priority
?
591 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 15

Assisted Solution

by:Aaron Shilo
Aaron Shilo earned 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
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
Suggested Courses

752 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