Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Data transformation MMDDYYYY to YYYY-MM-DD

$
0
0

Hello all,

Im working on a SSIS Package and I have to do a data transformation but this one is a but tricky. For example

7/6/2015 is my date and when I apply

SUBSTRING(ColumnName,5,4)  + "-" + SUBSTRING(ColumnName,3,1) + "-" + SUBSTRING(ColumnName, 1,1)

I get 2015-6-7 which is good

but then when the date is like 10/12/2015 I would have to modify my code

My question is, Is their anything I can add to the code to make the single digits have a zero before them so I can use the same code throughout. My updated code would then be

SUBSTRING(ColumnName,7,4)  + "-" + SUBSTRING(ColumnName,4,2) + "-" + SUBSTRING(ColumnName, 2,1)

Thank you!


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>