Reputation: 502
I am writing a query in LogParser Studio (and have also tried it in command line LogParser 2.2) in trying to find results that have a date between two specified dates in the query.
I get the error message (below) whenever I run it.
Error parsing query: Syntax Error: <from-clause>:expecting FROM keyword instead
of token 'TO_TIMESTAMP(date,time)' [SQL query syntax invalid or unsupported.]
Here is the query (below). Note that I do replace '[LOGFILEPATH]' with the actual path when I try this in the command line LogParser. The path to the log files is \inetpubs\logs\b\*.log
Also, I've tried removing the single quotes in the dates, with no positive results.
Thanks for your help.
SELECT LocalDateTime, USING TO_TIMESTAMP(date,time) AS LocalDateTime into
OUTPUT.CSV FROM '[LOGFILEPATH]' where LocalDateTime BETWEEN TIMESTAMP ('2012-01-06
13:50:00', 'yyyy-MM-dd hh:mm:ss') And TIMESTAMP ('2012-01-07 14:00:00', 'yyyy-MM-dd
hh:mm:ss') order by LocalDateTime DESC
Upvotes: 0
Views: 314
Reputation: 3042
I made some modifications to your query to fit my log. My log file doesn't have LocalDateTime so I change it to s-ip. I also removed into OUTPUT.CSV because there's another issue. I'm not sure if you have same issue. But it can work after remove it.
If you also have this issue, try to remove into OUTPUT.CSV .
So the issue is caused by USING TO_TIMESTAMP(date,time). If you want to use TO_TIMESTAMP function, just use it and no need to add USING.
Same error with you.
But it worked well after I removed the USING.
Upvotes: 0