Solved

Alias in Microsoft Query no longer recognized

Posted on 2013-01-09
5
960 Views
Last Modified: 2013-01-19
I have some Excel 2010 workbooks that connect to an Oracle database. Data is returned via Microsoft Query. The query contains some aliases. The data continues to be returned to the spreadsheet with no errors on update. However, if I try to edit the query, I get the following error message: ORA-923: FROM keyword not found where expected. I've discovered that if I delete the alias, I do not get the error.

At first I thought it had to do with upgrading to a new computer (Windows 7 64bit), but I've tested on older computers in the office and I get the same error.

The code follows:
SELECT AR_TRX_HEADER.SONO, AR_TRX_HEADER.INVOICEDATE, GA_BLOCK.ID, Sum(AR_TRX_PRODUCT.QNT) AS "SHIP", AR_TRX_CHARGE_VIEW.QNT AS "SOLD", Sum(AR_TRX_HEADER_AUX.QNT) AS "COUNT", Sum(AR_TRX_PRODUCT.QNT*AR_TRX_DETAIL.COSTPRICE) AS "REVENUE"
FROM COMPANY_1.AR_TRX_CHARGE_VIEW AR_TRX_CHARGE_VIEW, COMPANY_1.AR_TRX_DETAIL AR_TRX_DETAIL, COMPANY_1.AR_TRX_HEADER AR_TRX_HEADER, COMPANY_1.AR_TRX_HEADER_AUX AR_TRX_HEADER_AUX, COMPANY_1.AR_TRX_PRODUCT AR_TRX_PRODUCT, COMPANY_1.GA_BLOCK GA_BLOCK
WHERE AR_TRX_PRODUCT.ARTRXHDRIDX = AR_TRX_HEADER.ARTRXHDRIDX AND AR_TRX_DETAIL.ARTRXHDRIDX = AR_TRX_PRODUCT.ARTRXHDRIDX AND AR_TRX_DETAIL.ARTRXDTLSEQ = AR_TRX_PRODUCT.ARTRXDTLSEQ AND AR_TRX_HEADER_AUX.ARTRXHDRIDX = AR_TRX_PRODUCT.ARTRXHDRIDX AND AR_TRX_HEADER_AUX.ARTRXDTLSEQ = AR_TRX_DETAIL.ORIGINALSEQ AND GA_BLOCK.GABLOCKIDX = AR_TRX_PRODUCT.GABLOCKIDX AND AR_TRX_CHARGE_VIEW.ARTRXHDRIDX = AR_TRX_PRODUCT.ARTRXHDRIDX
GROUP BY AR_TRX_HEADER.SONO, AR_TRX_HEADER.INVOICEDATE, GA_BLOCK.ID, AR_TRX_CHARGE_VIEW.QNT, AR_TRX_DETAIL.GLDELETECODE, AR_TRX_HEADER_AUX.TAB, AR_TRX_HEADER.CUSTNAMEIDX, AR_TRX_CHARGE_VIEW.CHARGEMETHODTYPE, AR_TRX_CHARGE_VIEW.FCCHARGEIDX, AR_TRX_CHARGE_VIEW.LINENO, AR_TRX_PRODUCT.GABLOCKIDX
HAVING (AR_TRX_HEADER.INVOICEDATE>{ts '2012-01-01 00:00:00'} And AR_TRX_HEADER.INVOICEDATE<={ts '2012-12-31 00:00:00'}) AND (AR_TRX_DETAIL.GLDELETECODE='N') AND (AR_TRX_HEADER_AUX.TAB=2) AND (AR_TRX_HEADER.CUSTNAMEIDX=9) AND (AR_TRX_CHARGE_VIEW.CHARGEMETHODTYPE='1') AND (AR_TRX_CHARGE_VIEW.FCCHARGEIDX=17) AND (AR_TRX_CHARGE_VIEW.LINENO=1) AND (AR_TRX_PRODUCT.GABLOCKIDX<>128 And AR_TRX_PRODUCT.GABLOCKIDX<>127 And AR_TRX_PRODUCT.GABLOCKIDX<>135)
ORDER BY AR_TRX_HEADER.INVOICEDATE
0
Comment
Question by:clcarlson
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
Should the alias column names have quotes around them?
0
 

Author Comment

by:clcarlson
Comment Utility
I've tried double quotes, single quotes, no quotes, no AS. Nothing seems to work any more. Originally the query had single quotes and no error. The issue began mid-December. I notice there were quite a few Office 2010 updates on 12-12-12.
0
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
I haven't played with MS Query in Excel 2010 yet, so not sure why it would bark at you.... hopefully someone with some experience can further assist...
0
 

Accepted Solution

by:
clcarlson earned 0 total points
Comment Utility
Contacted Microsoft support. It was a known issue. It required an edit to the registry:
1. HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\query\options
2. After you select the subkey that is specified in step 1, point to New on the Edit menu, and then click DWORD Value.
3. Type AllowAlias, and then press ENTER.
4. Right-click AllowAlias, and then click Modify.
5. In the Value data box, type 2, and then click OK.
6. On the File menu, click Exit to exit Registry Editor.
0
 

Author Closing Comment

by:clcarlson
Comment Utility
Because I found the solution myself by contacting Microsoft support.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now