dbTalk Databases Forums  

Error in mdx querys with quotation marks

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Error in mdx querys with quotation marks in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew Vinich via SQLMonster.com
 
Posts: n/a

Default Error in mdx querys with quotation marks - 03-22-2005 , 01:09 PM






The problem:

When I try to execute a mdx with quotation mark inside, I get an error!

Why?
I know that (') is from mdx language.
Will I have to erase this characters from my databases?
I don't think it's good.

In my javascript code(asp):
var cst = new ActiveXObject("ADOMD.Cellset");
....
cst.Source = strSource + " CELL PROPERTIES FORMATTED_VALUE, BACK_COLOR,
FORE_COLOR";
cst.open();


strSource = " 'with ...'
Select {[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa].[Sigla].[Todos os Programas].[APOIO A PROJ SOCIAL],[Programa].
[Sigla].[Todos os Programas].[APOIO ENSINO SUPERIO]}
on rows,{[Measures].[Libera??es]} ON COLUMNS FROM [dwe_cubo_pird] CELL
PROPERTIES FORMATTED_VALUE, BACK_COLOR, FORE_COLOR"


The error occur when I execute cst.open()!
Microsoft? OLE DB Provider for Analysis Services error '80040e14'
Syntax error, expecting SELECT, near: 'A INDUSTRIA],[Programa].[Sigla].
[Todos...

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-22-2005 , 02:41 PM






You need to double up quotation marks within quotes:

Quote:
strSource = " 'with ...'
Select {[Programa].[Sigla].[Todos os Programas].[Ajudar ''A INDUSTRIA],
[Programa].[Sigla].[Todos os Programas].[APOIO A PROJ
SOCIAL],[Programa].
[Sigla].[Todos os Programas].[APOIO ENSINO SUPERIO]}
on rows,{[Measures].[Libera??es]} ON COLUMNS FROM [dwe_cubo_pird] CELL
PROPERTIES FORMATTED_VALUE, BACK_COLOR, FORE_COLOR"
Quote:

Here's an earlier thread that discusses this:

http://groups-beta.google.com/group/...rver.olap/msg/
5b1f83a30f0203eb
Quote:
Newsgroups: microsoft.public.sqlserver.olap
From: "George Spofford"
Date: Sat, 1 Jun 2002 07:33:16 -0700

Subject: MDX Error with Current Year's

One of those silly things: double it up inside.

With member [measures].[abc] as
'count(descendants([category].*[all Category].[current
year''s].[actuals],,leaves))'

HTH

--
George Spofford
Microsoft MVP
Chief Architect / OLAP Solution Provider
DSS Lab
http://www.dsslab.com
geo... (AT) dsslab (DOT) com
ISVs & IT organizations: Find out how DSS Lab can speed
your development!


Quote:
-----Original Message-----
Hello,
the following MDX fails:

The error comes because the uniquename is ..year's]

With member [measures].[abc] as
'count(descendants([category]*.[all Category].[current
year's].[actuals],,leaves))'

How can i write a valid mdx?

Thanks for reading this
J鰎g
.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #3  
Old   
Andrew Vinich - Brazil
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-23-2005 , 02:41 PM



There is another error!

Microsoft庐 OLE DB Provider for Analysis Services error '80040e14'

Formula error - cannot find dimension member ("[Programa].[Sigla].[Todos os
Programas].[APOIO ''A INDUSTRIA]") - in a name-binding function

/Server_1.asp, line 520


"Deepak Puri" wrote:

Quote:
You need to double up quotation marks within quotes:


strSource = " 'with ...'
Select {[Programa].[Sigla].[Todos os Programas].[Ajudar ''A INDUSTRIA],
[Programa].[Sigla].[Todos os Programas].[APOIO A PROJ
SOCIAL],[Programa].
[Sigla].[Todos os Programas].[APOIO ENSINO SUPERIO]}
on rows,{[Measures].[Libera??es]} ON COLUMNS FROM [dwe_cubo_pird] CELL
PROPERTIES FORMATTED_VALUE, BACK_COLOR, FORE_COLOR"



Here's an earlier thread that discusses this:

http://groups-beta.google.com/group/...rver.olap/msg/
5b1f83a30f0203eb

Newsgroups: microsoft.public.sqlserver.olap
From: "George Spofford"
Date: Sat, 1 Jun 2002 07:33:16 -0700

Subject: MDX Error with Current Year's

One of those silly things: double it up inside.

With member [measures].[abc] as
'count(descendants([category].-[all Category].[current
year''s].[actuals],,leaves))'

HTH

--
George Spofford
Microsoft MVP
Chief Architect / OLAP Solution Provider
DSS Lab
http://www.dsslab.com
geo... (AT) dsslab (DOT) com
ISVs & IT organizations: Find out how DSS Lab can speed
your development!


-----Original Message-----
Hello,
the following MDX fails:

The error comes because the uniquename is ..year's]

With member [measures].[abc] as
'count(descendants([category]-.[all Category].[current
year's].[actuals],,leaves))'

How can i write a valid mdx?

Thanks for reading this
Jvrg
.



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #4  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-24-2005 , 12:33 AM



Maybe you used double-quote characters (Ascii 34), instead of 2
single-quote characters (Ascii 39) - that's the only way I could create
the error message you got?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #5  
Old   
Andrew Vinich - Brazil
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-28-2005 , 09:17 AM



I didn't use double-quote characters (Ascii 34). I duplicate the ' in the
string, but it didn't work. I have to repair this error fast. It's crucial
for my application to repair this problem.

I used:
STRING_mdx.replace(/\'/mig,"''");

ERROR
<p>Microsoft庐 OLE DB Provider for Analysis Services</font> <font
face="Arial" size=2>error '80040e14'</font>
<p>
<font face="Arial" size=2>Formula error - cannot find dimension member
("[Programa].[C贸dSigla].[Todos os Programas].[010001 - APOIO ''A INDUSTRIA]")
- in a name-binding function</font>
<p>
<font face="Arial" size=2>/Server_1.asp</font><font face="Arial" size=2>,
line 520</font>


I'm waiting for a solution.

"Deepak Puri" wrote:

Quote:
Maybe you used double-quote characters (Ascii 34), instead of 2
single-quote characters (Ascii 39) - that's the only way I could create
the error message you got?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #6  
Old   
Andrew Vinich - Brazil
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-28-2005 , 10:41 AM



Is there any escape character in MDX Syntax?

"Andrew Vinich - Brazil" wrote:

Quote:
I didn't use double-quote characters (Ascii 34). I duplicate the ' in the
string, but it didn't work. I have to repair this error fast. It's crucial
for my application to repair this problem.

I used:
STRING_mdx.replace(/\'/mig,"''");

ERROR
p>Microsoft庐 OLE DB Provider for Analysis Services</font> <font
face="Arial" size=2>error '80040e14'</font
p
font face="Arial" size=2>Formula error - cannot find dimension member
("[Programa].[C贸dSigla].[Todos os Programas].[010001 - APOIO ''A INDUSTRIA]")
- in a name-binding function</font
p
font face="Arial" size=2>/Server_1.asp</font><font face="Arial" size=2>,
line 520</font


I'm waiting for a solution.

"Deepak Puri" wrote:

Maybe you used double-quote characters (Ascii 34), instead of 2
single-quote characters (Ascii 39) - that's the only way I could create
the error message you got?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #7  
Old   
Elad I
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-28-2005 , 10:53 AM




I think your problem is the fact you wrap the WITH keyword with single
quotes ('). There really shouldn't be a problem with using single
quotes in names of members, unless you use them in calculation value
declarations, in which case you have to use double single quotes ('').

Instead of:

strSource = " 'with ...'
Select {[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa..."

try:

strSource = " with ... ' <your calculation value here> '" + "Select
{[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa..."

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #8  
Old   
Andrew Vinich - Brazil
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-28-2005 , 01:37 PM



Sorry...The correctly code is:

with member [Programa].[C贸dSigla].[Todos os Programas].[Sub Total] AS
'Aggregate({[Programa].[C贸dSigla].[Todos os Programas].[000000 - SEM
PROGRAMA],[Programa].[C贸dSigla].[Todos os Programas].[010001 - APOIO 'A
INDUSTRIA],[Programa].[C贸dSigla].[Todos os Programas].[011010 -
INS.BAS.-MINERACAO],[...]
})' SELECT {[Programa].[C贸dSigla].[Todos os Programas].[000000 - SEM
PROGRAMA],[Programa].[C贸dSigla].[Todos os Programas].[010001 - APOIO 'A
INDUSTRIA],[Programa].[C贸dSigla].[Todos os Programas...ON COLUMNS FROM [cubo]
CELL PROPERTIES FORMATTED_VALUE, BACK_COLOR, FORE_COLOR

"Elad I" wrote:

Quote:
I think your problem is the fact you wrap the WITH keyword with single
quotes ('). There really shouldn't be a problem with using single
quotes in names of members, unless you use them in calculation value
declarations, in which case you have to use double single quotes ('').

Instead of:

strSource = " 'with ...'
Select {[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa..."

try:

strSource = " with ... ' <your calculation value here> '" + "Select
{[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa..."

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #9  
Old   
Andrew Vinich - Brazil
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-28-2005 , 01:43 PM



In the Excel this query works fine. I don't know how it works in Excel's
background to do this...I tryed to duplicate the single-quoted('), but it's
still wrong.

The error:
Microsoft庐 OLE DB Provider for Analysis Services error '80040e14'
Formula error - cannot find dimension member ("[Programa].[C贸dSigla].[Todos
os Programas].[010001 - APOIO ''A INDUSTRIA]") - in a name-binding function


"Elad I" wrote:

Quote:
I think your problem is the fact you wrap the WITH keyword with single
quotes ('). There really shouldn't be a problem with using single
quotes in names of members, unless you use them in calculation value
declarations, in which case you have to use double single quotes ('').

Instead of:

strSource = " 'with ...'
Select {[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa..."

try:

strSource = " with ... ' <your calculation value here> '" + "Select
{[Programa].[Sigla].[Todos os Programas].[Ajudar 'A INDUSTRIA],
[Programa..."

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #10  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Error in mdx querys with quotation marks - 03-28-2005 , 06:33 PM



To confirm: you doubled the quote within quotes, like:

Quote:
with member [Programa].[C贸dSigla].[Todos os Programas].[Sub Total] AS
'Aggregate({[Programa].[C贸dSigla].[Todos os Programas].[000000 - SEM
PROGRAMA],[Programa].[C贸dSigla].[Todos os Programas].[010001 - APOIO
''A
INDUSTRIA],[Programa].[C贸dSigla].[Todos os Programas].[011010 -
INS.BAS.-MINERACAO],[...]
})' SELECT {[Programa].[C贸dSigla].[Todos os Programas].[000000 - SEM
PROGRAMA],[Programa].[C贸dSigla].[Todos os Programas].[010001 - APOIO 'A
INDUSTRIA],[Programa].[C贸dSigla].[Todos os Programas...ON COLUMNS FROM
[cubo]
CELL PROPERTIES FORMATTED_VALUE, BACK_COLOR, FORE_COLOR
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.