Forum Discussion

snowstar's avatar
snowstar
Frequent Visitor
3 years ago
Solved

Dynamic Parameter m Error with text value including -

Hello!   My Dynamic Parameter m is giving an error when the text value from a list of plain parameter has a hyphen (-) in it.   Like 312-34   Not sure why, I defined as text.   I get this err...
  • snowstar's avatar
    snowstar
    3 years ago

    Thanks for your help! (Not sure if I replied at the right spot)

     

    This is the Query Code:

     

    = Sql.Database("MTLSQL01", "Reco_DEF", [Query="SELECT *#(lf)FROM OPENQUERY ([MTLSQL01],#(lf)'EXEC Reco_DEF.dbo.DEF_Customer_Detail_NoDuplication_pbi " & ParamCustomer & ",
    " & ParamCustomerLocation & " , " & Division & " ') " ])

     

    This is the parameter code:

    "2705-10" meta [IsParameterQuery=true, ExpressionIdentifier=CustomerLocation, Type="Text", IsParameterQueryRequired=true]

     

    If I put the parameter in quotes in current value:  "2705-10" It works.

    """2705-10""" meta [IsParameterQuery=true, ExpressionIdentifier=CustomerLocation, Type="Text", IsParameterQueryRequired=true]

     

     

     

    Thaks in advance.

     

     

  • snowstar's avatar
    snowstar
    3 years ago

    I fixed the issue.

    After running profiler, I copied and pasted statement that was sent and ran it in sql.

    It failed.

    I added brackets to my parameter in sql and it worked.

    I then added brackets in m:

    [" & ParamCustomerLocation & "]

    and it worked!

    Maybe I need to do this because I am using OPENQUERY?

     

    In any case thanks for your help watkinnc.