2

Here is the query for the dataset:

SELECT DISTINCT CompanyId, Company
FROM            User_Hierarchy_Mapping
WHERE           UserId = @FieldManager

FieldManager is the parameter name. It's not taking the value of the parameter.

Please help me with the syntax to pass a parameter to a MySQL query.

1
  • Take a look at SET!
    – Vérace
    Jul 26, 2016 at 17:27

1 Answer 1

6

If you are using a MySQL ODBC connector in SSRS you can't use named parameters but you should use ? instead.

So for your query it should look like:

SELECT DISTINCT CompanyId, Company
FROM            User_Hierarchy_Mapping
WHERE           UserId = ?

That way you should get a parameter named Parameter1. If you have more than one question mark your parameters will be named Parameter1, Parameter2 etc in the same order as they appear in the query.

This isn't specific to MySQL but to any ODBC connection. See Binding Parameters ODBC for reference.

3
  • How to change this to allow IN clause, I am not able to make it work for multi select for MySQL ODBC
    – ZAJ
    Apr 3, 2021 at 8:37
  • @ZAJ you will need to concatenate it in an expression
    – Tom V
    Apr 4, 2021 at 14:47
  • Cheers, got it.
    – ZAJ
    Apr 5, 2021 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.