Solved

Date time conversion in SSIS

Posted on 2016-11-28
6
18 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 18

Expert Comment

by:Pawan Kumar Khowal
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 18

Expert Comment

by:Pawan Kumar Khowal
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 18

Expert Comment

by:Pawan Kumar Khowal
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Today I will describe a subset of an ETL I made and I think that could be useful for you and it will be useful for me if I receive your feedback.1. The Problem I have customer's data (sent by an application by text files to a specific file system s…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now