Vinny
Vinny

Reputation: 789

Google BigQuery Error: Syntax error: Illegal input character "%"

I'm trying to use Google's BigQuery NodeJs library, however, I keep getting this error.

Input example:

{"name": "John Doe", "gameid": "048.611"}

And here is an example of my query.

const query = 'select * from gametag_ae.users where GAMEID like %' + gameid + '% where NAME like %' + name + '% LIMIT 1';

And this is the error that I'm getting:

(node:6802) UnhandledPromiseRejectionWarning: Error: Syntax error: Illegal input character "%" at [1:64]

I can't use the operator % in this case, but it's necessary for this query.

What would be a better approach to get it working?

Upvotes: 0

Views: 6254

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172993

use below

const query = 'select * from gametag_ae.users where GAMEID like "%' + gameid + '%" AND NAME like "%' + name + '%" LIMIT 1';

Upvotes: 1

Related Questions