Applies to FME Workbench 2017.1
If you apply a select statement on a DataReader (in this example MS SQL Non Spatial), it misreads the SQL if there are embedded comments, treating everything after the first comment as a comment, hence producing wrong result.
My Sample Workspace
Here is my workspace (a simplified version to illustrate the problem). I used a DataReader and a SQLExecutor to show the inconsistency in number of records read, resulting from incorrect parsing of SQL statement on the DataReader. Both the DataReader and SQLExecutor have the exact same select SQL. The correct number of records should be 98,792.
DataReader select statement configuration:
After I press OK and go back into it, looks like this:
And now the SQLExecutor configuration:
The SQLExecutor has the same SQL as above, yet produces the correct result. The Editor dialog automatically detects that it is SQL and gives the appropriate syntax highlighting (whereas the DataReader dialog doesn't).
Conclusions:
- The DataReader doesn't interpret the select SQL correctly where there are comments.
- Removing the comments makes the DataReader produce the correct result again.
- Surprisingly the SQLExecutor does not suffer from this problem and produces the correct result, regardless if there are comments or not.
- The SQLExecutor also preserves the original formatting of the SQL (carriage/returns, indents, etc.), whereas the DataReader doesn't and turns everything into a single line of text.