Error "Incorrect syntax near 'dbo'." when that text is not present

Our Ms SQL Server uses fully qualified table names, with schema.dbo.tablename, and that is how I created a query. This error turned up: “Incorrect syntax near ‘dbo’.”
So, I prefaced the query with “use schema”, and referred only to tablename(s).
The same error remains even though “dbo.” is no longer part of the query text.
FYI, it is difficult to debug a query based on errors that refer to text that is not present.

Made a few changes, new error: Incorrect syntax near ‘@P2’.
Of course, ‘@P2’ is not in the query either

Some more changes, now “Incorrect syntax near ‘IN’.”
As before, ‘IN’ is not ‘IN’ the query,

I would suggest. Just create a custom question, convert it to a query and see how the tables are referred and use that nomenclature

Please post “Diagnostic Info” from Admin > Troubleshooting.
And post the query and what you’re trying to do, it makes it easier to help.
The error is returned from the server - it’s not something Metabase knows much about.