Home: Local Software with Web: royalblue:
SQL code to convert HD9digit code to d/m/yyyy



DorjeM
Member

Aug 7, 2001, 5:51 PM

SQL code to convert HD9digit code to d/m/yyyy

In the spirit of sharing information rather than just asking questions, the following code will extract day month year from the HelpDesk 9 digit number.
Useful if you've got to do some manual database work

SQL script

-- Replace TSDATE with appropriate
-- column name you want to report on
-- Change table if required
-- Will return d/m/yyyy from the HelpDesk date 9 digit number

select
(
cast(cast(tsdate - (round((TSDATE/65536),0,1)*65536) - (round(((tsdate-(round((TSDATE/65536),0,1)*65536))/256),0,1)*256)as int)as varchar)
+'/'+
cast(cast(round(((tsdate-(round((TSDATE/65536),0,1)*65536))/256),0,1)as int)as varchar)
+'/'+
cast(cast(round((TSDATE/65536),0,1)as int)as varchar)
)
as CallTsdate
from call