November 5, 2018 at 10:57 am
David Burrows - Monday, November 5, 2018 9:21 AMJeff Moden - Monday, November 5, 2018 9:00 AMThanks, David. With the understanding that I don't know SSIS syntax, would (DT_DATE)((DT_STR,10,1252)SUBSTRING(Date,2,10) do the same thing or do you really have to do the character by character conversion using individual SUBSTRING(pos,1) like you did?SSIS has no HEX to string conversion functionality, only integer to HEX.
Typical MS :angry:
Ok... thanks for the info, David.
Since you know me, it'll probably come as no surprise to you that I look at this as yet another reason for me to avoid SSIS. 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
November 9, 2018 at 6:48 am
Doesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
November 9, 2018 at 8:40 am
sgmunson - Friday, November 9, 2018 6:48 AMDoesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Heh... even with that, I'm still hating SSIS for this type of stuff. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
November 9, 2018 at 9:20 am
sgmunson - Friday, November 9, 2018 6:48 AMDoesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Except for 0x323031342D30342D3033
:Whistling:
Far away is close at hand in the images of elsewhere.
Anon.
November 14, 2018 at 6:24 am
David Burrows - Friday, November 9, 2018 9:20 AMsgmunson - Friday, November 9, 2018 6:48 AMDoesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Except for 0x323031342D30342D3033
:Whistling:
2014-04-03 is the result string. Why is that a problem?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
November 15, 2018 at 2:00 am
sgmunson - Wednesday, November 14, 2018 6:24 AMDavid Burrows - Friday, November 9, 2018 9:20 AMsgmunson - Friday, November 9, 2018 6:48 AMDoesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Except for 0x323031342D30342D3033
:Whistling:2014-04-03 is the result string. Why is that a problem?
Because it doesn't, it produces 2014-04-0
🙂
Far away is close at hand in the images of elsewhere.
Anon.
November 19, 2018 at 12:14 pm
David Burrows - Thursday, November 15, 2018 2:00 AMsgmunson - Wednesday, November 14, 2018 6:24 AMDavid Burrows - Friday, November 9, 2018 9:20 AMsgmunson - Friday, November 9, 2018 6:48 AMDoesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Except for 0x323031342D30342D3033
:Whistling:2014-04-03 is the result string. Why is that a problem?
Because it doesn't, it produces 2014-04-0
🙂
Then repeat the (DT_STR,10,1252) between the replace functions until you find which one shortens it.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
November 19, 2018 at 4:12 pm
sgmunson - Monday, November 19, 2018 12:14 PMDavid Burrows - Thursday, November 15, 2018 2:00 AMsgmunson - Wednesday, November 14, 2018 6:24 AMDavid Burrows - Friday, November 9, 2018 9:20 AMsgmunson - Friday, November 9, 2018 6:48 AMDoesn't have to actually be that long. Once you have the human readable string, here's the SSIS code to get it into a date:(DT_DATE)((DT_STR,10,1252)REPLACE(REPLACE(REPLACE('0x323031342D30342D3037', '0x', ''), '2D', '-'), '3', ''))
EDIT: you might or might not need the REPLACE that turns 2D into a dash. You can test that...
Except for 0x323031342D30342D3033
:Whistling:2014-04-03 is the result string. Why is that a problem?
Because it doesn't, it produces 2014-04-0
🙂Then repeat the (DT_STR,10,1252) between the replace functions until you find which one shortens it.
Heh... hating SSIS a little more with each passing post. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
November 19, 2018 at 5:11 pm
why not just convert the date to a string on the source select - converting to a format that SSIS knows well will then make the conversion to date straightforward.
And if the source is not a select (where you could change the format) then passing it through a c# script component would make it a lot easier to do the conversion than trying to mess around with a data conversion task - which if it needs to be changed going forward will be another pain to get right.
November 19, 2018 at 7:18 pm
Or... you could do it in T-SQL and not have to worry about SSIS or C#. 😉 Maybe even a persisted computed column on the table might work, eh?
--Jeff Moden
Change is inevitable... Change for the better is not.
December 5, 2018 at 10:04 am
frederico_fonseca - Monday, November 19, 2018 5:11 PMwhy not just convert the date to a string on the source select - converting to a format that SSIS knows well will then make the conversion to date straightforward.And if the source is not a select (where you could change the format) then passing it through a c# script component would make it a lot easier to do the conversion than trying to mess around with a data conversion task - which if it needs to be changed going forward will be another pain to get right.
This was the answer. Thanks to everyone who jumped in with ideas.
After a couple days battling SSIS to get this to work, I looked up data type conversions in MySQL and set the conversion in the source.
Ultimately, this probably should have been the first thing I tried. I appreciate everyone's ideas though, it was helpful and I learned a lot about conversions in SSIS.
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply