Log Parser wrongly displays date '9999-12-31 00:00:00'

174 Views Asked by At

I am using log parser 2.2 to parse pipe deleimited file. I have one column with default date '9999-12-31 00:00:00'. Log parser displays this value as '-6385-12-31 00:00:00'

Input File : Sample.txt

Date|Name

9999-12-31 00:00:00|Tim

Query : Query.sql

Select * from C:\Sample.txt

C:>logparser -i:TSV -headerRow:on -iSeparator:"|" -fixedSep:ON file:Query.sql -o:Datagrid

Output

C:\Sample.txt 2 -6385-12-31 00:00:00 Tim

Please help me to resolve this issue.

Thanks,

Sreeraj

1

There are 1 best solutions below

0
On

The maximum year supported by LogParser is somewhere around 3,000 - we never thought LogParser would last that long...

To workaround your issue, you might want to use the CASE clause to convert your default date to NULL. Example:

SELECT
   Field1,
   Field2,
   CASE TO_STRING(ThatDateField, 'yyyy')
     WHEN '-6385' THEN NULL
     ELSE ThatDateField
   END AS NewDateField,
   ....