Using Alias fields in Microsoft Query

G

gary

Does anyone have any info on why using Aliases in a SQL
query don't work in microsoft query. I have tried Office
2002 SP3 and Office 2003 and neither work.
When I enter the following as part of a query it strips
off everything after the AS.
SELECT Customers.strName AS [Customers]
 
J

Jamie Collins

...
Does anyone have any info on why using Aliases in a SQL
query don't work in microsoft query. I have tried Office
2002 SP3 and Office 2003 and neither work.
When I enter the following as part of a query it strips
off everything after the AS.
SELECT Customers.strName AS [Customers]

This style of alias works for me in MS Query e.g. this using northwind:

SELECT Customers.CompanyName
AS [CustomerName]
FROM Customers

Your problem may be covered by the following:

Microsoft Knowledge Base Article - 298955
Using a field alias in Query does not work with some third-party databases
http://support.microsoft.com/default.aspx?scid=kb;en-us;298955

Jamie.

--
 
J

Jamie Collins

...
try = instead of as

I tried this (northwind):

SELECT Customers.CompanyName
= [CustomerName]
FROM Customers

and got an error, 'Incorrect column expression'.

Jamie.

--
 
K

KellyJMF

When I'm in MS Query, I double-click on the column to bring up the "Edi
Column..." dialog box and change the column name there. In the SQ
statement it looks like this:

SELECT BLDG.BLDGNAME AS 'Property Name'

I'm using Excel 2000 and my queries are against a SQL 2000 db
 
K

KellyJMF

When I'm in MS Query, I doulble-click on the column to bring up th
"Edit Column..." dialog box and change the column name there. In th
SQL statement it looks like this:

SELECT BLDG.BLDGNAME AS 'Property Name'

I'm using Excel 2000 and my queries are against a SQL 2000 db
 
Top