Quantcast
Channel: FLEXquarters.com Limited
Viewing all articles
Browse latest Browse all 313

Troubleshooting - Cannot use alias in MS Query

$
0
0

Troubleshooting - Cannot use alias in MS Query

Problem Description:

I am getting the below error message when trying to SELECT data fields AS Alias, the statement runs fine otherwise.

[sql syntax error] Expected lexical element not found:=

Please see the following SQL statement:

SELECT Item.Name AS SKU, Item.CustomFieldColor AS Item, Item.Description, Item.SalesPrice, Item.PurchaseCost, Item.QuantityOnHand FROM Item Item WHERE (Item.Name<>'IFR' And Item.Name<>'OTW') AND (Item.Description<>'') AND (Item.Type='ItemInventory') ORDER BY Item.Name

The above statement is working fine in VB Demo, MS Access. But I am facing issue in MS Excel.  


http://support.flexquarters.com/esupport/newimages/MSQueryAlias/step1.PNG

 

Solutions:

MS Excel has some issue when you alias in the query. When you try to use Microsoft Query to return data from some third-party databases into Microsoft Excel, apostrophes (') around alias names can cause the query to fail.

Please refer below mentioned link to resolve this issue:

Using a field alias in Query does not work with some third-party databases

You can either apply hot fix or change registry values.

Result after changing registry values & execute query again:

http://support.flexquarters.com/esupport/newimages/MSQueryAlias/step2.PNG


Viewing all articles
Browse latest Browse all 313

Trending Articles