Solved

date conversion in SSIS package

Posted on 2011-03-25
5
579 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 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Parsing this XML works but the other one doesn't 9 27
help converting varchar to date 14 25
Split string into 3 separate fields 5 19
Database Owner 3 15
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

763 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