?
Solved

Date time conversion in SSIS

Posted on 2016-11-28
6
Medium Priority
?
63 Views
Last Modified: 2016-11-30
I am extracting data from Sql table's and exporting it to Excel, i am using data conversion transformation between source and target., in data conversion transformation I am using DT_Date to convert the data, when I use DT_date I am getting result as date + time.
However I just want date in MM-DD-YYYY format.

How can I achieve this using data conversion transformation?
0
Comment
Question by:Sriv
[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
  • 3
  • 2
6 Comments
 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41904520
try..

(DT_DBDATE)(DT_DATE)GETDATE()

Use yourcolumnName instead of GETDATE()
0
 

Author Comment

by:Sriv
ID: 41904586
Pawan  I am using data conversion transformation and I dont think we can write expressions in Data conversion transformtion  is that right?

Please correct me if I am wrong
0
 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41905211
Try...this then

1. Goto advanced editor of data conversion transformation -> Input & Output Properties -> YourDate Column
2. FastParse = True <<  in Custom Properties >>
3. Change DataType of yourDate columne to [DT_DBDATE]

Hope it helps !!
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 13

Accepted Solution

by:
Arifhusen Ansari earned 2000 total points
ID: 41905216
may be i don't know what's your exact requirement is?

Custom formatting is not possible in SSIS.

I would suggest you to get the date in the format you want, directly from sql database.

SELECT FORMAT(getdate(),'MM-dd-yyyy')

Open in new window


In your case

SELECT FORMAT(yourtablecolumn,'MM-dd-yyyy')

Open in new window


And you don't even need to use the data conversion in the package.

May be you need to write query rather that loading data directly from table.

Hope it will help.
0
 
LVL 29

Expert Comment

by:Pawan Kumar
ID: 41905218
Yes this is good option by Arifhusen.

Also note that Format is only available in SQL 2012+. Format converts the DATE column into string. So don't use format function. It should only used for display only purpose.

You should use

SELECT
CAST(yourtablecolumn AS DATE) yourtablecolumn
FROM TABLE

Hope it helps !
0
 

Author Comment

by:Sriv
ID: 41907849
Thanks!
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Over the last 2 years, I have been working on SSIS 2008. Really the tough tasks in SSIS are to deploy packages and pass parameters (Values from outside package). The latter is certainly a headache for developers, particularly for me. We had to ma…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
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