wrong results due to date-format?
Posted on 2008-11-07
I do have the tbl dbo.GFArchiv where I have millions of rst including dbo.GFArchiv.DatumBerechnung in datetime format and a tbl dbo.GF_V1_Investmentratio with Datum, formerly in smalldatetime changed into datetime but did not solve issue. I previously deleted all entries in dbo.GF_V1_Investmentratio and feeded all new with dbo.GFArchiv.DatumBerechnung.Datum which worked fine but took more then an hour to execute. Therefore, I would like to insert only the latest dates of dbo.GFArchiv.DatumBerechnung which are not yet included in dbo.GF_V1_Investmentratio to perform faster. Trying
SELECT DISTINCT dbo.GFArchiv.DatumBerechnung
FROM dbo.GFArchiv LEFT OUTER JOIN
dbo.GF_V1_Investmentratio ON CONVERT(smalldatetime, CONVERT(char(10), dbo.GFArchiv.DatumBerechnung, 104), 104) > CONVERT(smalldatetime,
CONVERT(char(10), dbo.GF_V1_Investmentratio.Datum, 104), 104)
brings back all dates of dbo.GFArchiv.DatumBerechnung and not only > dbo.GF_V1_Investmentratio.Datum
any idea where the bug is?