ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do you rename table headers in a query using Offic 07? (https://www.excelbanter.com/excel-worksheet-functions/200617-how-do-you-rename-table-headers-query-using-offic-07-a.html)

DFoster

How do you rename table headers in a query using Offic 07?
 
In older versions you could use AS after the field name and replace the name,
now that doesn't work. Example would be select dwdata.lstnme AS "Last".
With this in the query it would bring back a column heading of Last instead
of lstnme.

Duke Carey

How do you rename table headers in a query using Offic 07?
 
I think you need to wrap the alias in single quotes

"DFoster" wrote:

In older versions you could use AS after the field name and replace the name,
now that doesn't work. Example would be select dwdata.lstnme AS "Last".
With this in the query it would bring back a column heading of Last instead
of lstnme.


DFoster

How do you rename table headers in a query using Offic 07?
 
It doesn't recognize the AS command anymore

"Duke Carey" wrote:

I think you need to wrap the alias in single quotes

"DFoster" wrote:

In older versions you could use AS after the field name and replace the name,
now that doesn't work. Example would be select dwdata.lstnme AS "Last".
With this in the query it would bring back a column heading of Last instead
of lstnme.


Duke Carey

How do you rename table headers in a query using Offic 07?
 
Are you using MS Query?


I just did this in MS Query with Excel 2007, using this SQL

SELECT Activity.LocationSize, Activity.Function AS 'Fnctn',
Activity.ActivityCount
FROM Activity Activity, location location
WHERE Activity.LocationSize = location.Lbound AND Activity.LocationSize <=
location.Ubound

It returns the data to Excel with the 2d column's heading being 'Fnctn' -
it unfortunately includes the single quotes in Excel



"DFoster" wrote:

It doesn't recognize the AS command anymore

"Duke Carey" wrote:

I think you need to wrap the alias in single quotes

"DFoster" wrote:

In older versions you could use AS after the field name and replace the name,
now that doesn't work. Example would be select dwdata.lstnme AS "Last".
With this in the query it would bring back a column heading of Last instead
of lstnme.



All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com