Escaping special characters in an MDX Query

牧云@^-^@ 提交于 2019-12-11 02:31:01

问题


I'm building a BI dashboard for my client. Our data is stored in an analysis server cube. Overall things work great, but a smartalec tester decided to create a merchant with the name `~!@#$%^&*()_+-=[]{}|;':"<>?,./ The name shows up just fine as a part of a query result, but if the user trys to drill in to the merchant we of course blow up b/c the \ { ; [ " are all part of MDX. Is there a way to escape these characters? I've tried putting a \ in front, or doubling the character. I've searched all over, but not turn up anything.

TIA


回答1:


You must use the [] notation for your names and escape (only) the right bracket. Here is an example declaring a calculated measure with the name to escape (notice the ]] ):

with member [`~!@#$%^&*()_+-=[]]{}|;':"<>?,./] as 42
select [`~!@#$%^&*()_+-=[]]{}|;':"<>?,./] on 0 from [cube]



回答2:


Could you try use [ ] brackets? I think it should help. But you should also "escape" your own brackets.

MSDN

If the body of the identifier contains only a left bracket ([), no additional handling is required. If the body of the identifier contains a right bracket (]), you must specify two right brackets (]]).



来源:https://stackoverflow.com/questions/7997814/escaping-special-characters-in-an-mdx-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!