I have a script from an SQL Server database that includes statements such as this:
INSERT SPECIAL_DAYS_TABLE (Date, Description) VALUES (CAST(0xB5330B00 AS Date), 'Christmas')
My question: how can I convert this into valid MySQL syntax? The cast part returns a null date value...
Unfortunately, I have no access to the SQLServer database, do direct data import is impossible - the script is the only thing that I can work with.
Note: there are hundreds of such statements, so I need to programmatically convert the cast part either in MySQL or outside MySQL (C/Java/Matlab/VB).
EDIT: answer closed as per how to cast the hexadecimal to varchar(datetime)? and the correction by Martin in the comment below
Apparently, the 0xB5330B00 should be interpreted as 0x000B33B5 (i.e., reverse the bytes) = 734133 (days since 0001-Jan-01)
CAST('0001-01-01 00:00:00' + INTERVAL CAST(0x000B33B5 AS SIGNED) DAY as date) => 2010-12-28