Solved

Date time conversion in SSIS

Posted on 2016-11-28
6
42 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
  • 3
  • 2
6 Comments
 
LVL 28

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 28

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 12

Accepted Solution

by:
Arifhusen Ansari earned 500 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 28

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
A couple of weeks ago, my client requested me to implement a SSIS package that allows them to download their files from a FTP server and archives them. Microsoft SSIS is the powerful tool which allows us to proceed multiple files at same time even w…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 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