metricsign
Start free
Low severityquery

Power BI Refresh Error:
102

What does this error mean?

SQL Server's parser found a syntax error in the query at or near the specified token.

Common causes

  • 1Missing comma, bracket, or keyword in a dynamically built SQL query
  • 2T-SQL syntax used in a non-SQL Server database dialect (e.g. MySQL syntax in SQL Server)
  • 3ADF pipeline generates incorrect SQL from a misconfigured query parameter

How to fix it

  1. 1Step 1: Run the failing query directly in SSMS to see the exact error location. The error message says 'near X' — look just before that token.
  2. 2Step 2: Use SQL Server's built-in parser to check without executing: SET PARSEONLY ON; <your query>; SET PARSEONLY OFF;
  3. 3Step 3: For dynamically built queries, print the SQL before executing: PRINT @sql; — then paste it into SSMS to debug.

Frequently asked questions

Why does error 102 say 'near ;' — the semicolon?

A semicolon error often means the statement before it is incomplete — e.g. a missing column in a SELECT list or a missing FROM clause. The parser fails at the semicolon because the prior statement is not valid.

Can ADF generate SQL with error 102?

Yes — if a pipeline parameter contains special characters or is empty, ADF may generate malformed SQL. Print the generated SQL in a Script activity before the query activity to debug.

Does dbt validate SQL syntax before running?

dbt compiles the Jinja-templated SQL to plain SQL and runs it. If the compiled SQL has a syntax error, dbt reports it as a compilation or runtime error with the SQL in the logs.

Official documentation: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors

Other query errors