Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Date time conversion in SSIS

Posted on 2016-11-28
6
Medium Priority
?
70 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 32

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 32

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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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 32

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

My client sends a request to me that they want me to load data, which will be returned by Web Service APIs, and do some transformation before importing to database. In this article, I will provide an approach to load data with Web Service Task and X…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

597 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