0

Thanks for reading this post. I am getting above error when trying to execute a sql through Log parser 2.2;

"Error : Syntax Error: : no SELECT keyword" when executing logparser sql file

.

This is what I have done:

  1. Created a SQL query which reads a log file located in a specific folder and create a new text file with updated data.

  2. Created a batch file to execute this SQL file using log parser.

    "C:\Program Files\Log Parser 2.2\logparser.exe" file:"C:\Temp\Concur\test\test.sql" -i:CSV -headerRow:OFF -fixedFields:OFF -o:CSV -headers:OFF"

  3. Run the batch file. It works as it should be. A new text file gets created.

Issue

  1. I updated the source file location in test.sql file. I used the same source file, but copied it to a different folder.

.... INTO * from 'C:\Temp\Concur\test\Working*.txt' ..

  1. Run the batch file, and I get above error:

"Error : Syntax Error: : no SELECT keyword" when executing logparser sql file

. 3. I revert the change I made, so now source file is pointed to original location. Run the batch file and still getting the same error.

Any thoughts guys?

Thanks very much.


SQL File:

    select  

CASE TO_UPPERCASE(SUBSTR(EXTRACT_TOKEN(Filename, 4, '_'),0,2))
WHEN 'RE' THEN  STRCAT(STRCAT(STRCAT(EXTRACT_PREFIX(EXTRACT_FILENAME(Filename), 3 ,'_'),'_Retry'),TO_STRING(ADD(TO_INT(SUBSTR(EXTRACT_TOKEN(Filename, 4, '_'),5,SUB(STRLEN(EXTRACT_TOKEN(Filename, 4, '_')),9))),1))),'.txt')
ELSE STRCAT(EXTRACT_PREFIX(EXTRACT_FILENAME(Filename), 3 ,'_'),'_Retry1.txt')
END AS newincrement


,Field1
,Field2
,Field3
,Field4
,Field5
,Field6
,Field7
,Field8
,CASE  Field10
    WHEN 'AU' THEN STRCAT('en_',Field10)
    WHEN 'CA' THEN STRCAT('en_',Field10) 
    WHEN 'GB' THEN STRCAT('en_',Field10) 
    WHEN 'IE' THEN STRCAT('en_',Field10)
    WHEN 'IN' THEN STRCAT('en_',Field10) 
    WHEN 'NZ' THEN STRCAT('en_',Field10) 
    WHEN 'US' THEN STRCAT('en_',Field10)
    WHEN 'ZA' THEN STRCAT('en_',Field10)
    ELSE 'en_GB' END AS Field9 
,Field10
,Field11
,Field12
,Field13
,Field14
,Field15
,Field16
,Field17
,Field18
,Field19
,Field20
,Field21
,Field22
,Field23
,Field24
,Field25
,Field26
,Field27
,Field28
,Field29
,Field30
,Field31
,Field32
,Field33
,Field34
,Field35
,Field36
,Field37
,Field38
,Field39
,Field40
,Field41
,Field42
,Field43
,Field44
,Field45
,Field46
,Field47
,Field48
,Field49
,Field50
,Field51
,Field52
,Field53
,Field54
,Field55
,Field56
,Field57
,Field58
,Field59
,Field60
,Field61
,Field62
,Field63
,Field64
,Field65
,Field66
,Field67
,Field68
,Field69
,Field70
,Field71
,Field72
,Field73
,Field74
,Field75
,Field76
,Field77
,Field78
,Field79
,Field80
,Field81
,Field82
,Field83
,Field84
,Field85
,Field86


INTO
    *   
from
    'C:\Temp\Concur\test\Working\*.txt'

Batch file:

"C:\Program Files\Log Parser 2.2\logparser.exe" file:"C:\Temp\Concur\test\test3.sql" -i:CSV -headerRow:OFF -fixedFields:OFF -o:CSV -headers:OFF
Lak Ranasinghe
  • 240
  • 4
  • 13

1 Answers1

0

Problem solved.

Thanks @GabrieleGiuseppini, It was the first one. When I saved the sql file, it was saved as UTF-8. I have saved it as ANSI, and all works now. Thanks for the help.

Lak Ranasinghe
  • 240
  • 4
  • 13