Forum Discussion
Insert Parameter in M language
- Anonymous8 years ago
Hi All,
So after many variations, it turns out it's the same as VBA without spaces. I was building a Paramaeterised Query and wanted a single place to change the value and it update the 6 Queries I have.
The Date value appeared like this "201801", so I created a variable and then managed to insert that using ""&Date&""
All working, thanks for you help. :)
The image you've posted is not an error-message, but a warning. If you click "Run", you should either get the desired result or an error-message. Please post that error-message if you need further help on that.
ImkeF Anonymous Yes, that is not an error. But the if you see the blue highlighted part in my image. This is in addion of server name. that means the code is changing my server name to value from paramter(Cname;Sname) including semicolon as well.
- Sname is SchemaName (parameter 1)
- Cname is ServerName (parameter 2)
Which makes the wrong server name and lead to error message. Please see the screenshot below. I have marked everything to make it more clear for you. Thank you for your help.
- Anonymous7 years agoNot applicable
Hi Kulchandra,
In your message you call the Sname variable your Schema, I believe this should be the Database within your Server. Maybe lost in translation, but that stands out to me.
If this is correct, your original query states the Database in the Select statement, therefore giving the Database twice.
My advice would be to first, run a simple query on your database using the non parameterised Server:Port and Database details, then examin the code it produces, using the Advanced Editor window. For my instance, I need to specify the implementation, if you see my original code. I got that from using the editor after using the above technique.
Hope that helps.
- Anonymous7 years agoNot applicable
Hi Anonymous ImkeF As per you suggestion I have made my query without Parameter. And, it looks like this(plz see screenshot) in Advance Editor windows and works perfectly fine without parameter.
What I am trying to do is embed the Parameter2 (Sname) in to Select Statment. I am able to embed server name Parameter1 (CName) already.
Hope you will find something on this image that will help to solve the problem i am facing. I am very thankful you guys are following up on this.