Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Renaming columns in MS Query

I use several MS Queries to import into Excel '03 workbooks via ODBC from our
corporate mainframe (linked Access tables). I would like to rename the column
headings in the query design before returning the results to Excel. However,
despite the options to do so, I keep getting error messages about a 'missing
expected lexical'. I even tried editing the SQL statement but got the same
results. What's the trick to make MS Query rename the columns?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,081
Default Renaming columns in MS Query

At a guess, you're trying to use column names that have spaces. Enclose
those names within a pair of single quotes.

select lname as 'Last Name' from somedatabase



"RhysPieces" wrote:

I use several MS Queries to import into Excel '03 workbooks via ODBC from our
corporate mainframe (linked Access tables). I would like to rename the column
headings in the query design before returning the results to Excel. However,
despite the options to do so, I keep getting error messages about a 'missing
expected lexical'. I even tried editing the SQL statement but got the same
results. What's the trick to make MS Query rename the columns?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Renaming columns in MS Query

This is an example of what I have : UnitofMeasure. What I want is UOM. There
are about 6 other columns but this is simply an example. If I can fix this
one the rest will be easy.

When using the suggestion below I get the error code: 'unexpected lexical
element missing:<identifier'. Please tell me what this means and a
work-around. Thanks again.

"Duke Carey" wrote:

At a guess, you're trying to use column names that have spaces. Enclose
those names within a pair of single quotes.

select lname as 'Last Name' from somedatabase



"RhysPieces" wrote:

I use several MS Queries to import into Excel '03 workbooks via ODBC from our
corporate mainframe (linked Access tables). I would like to rename the column
headings in the query design before returning the results to Excel. However,
despite the options to do so, I keep getting error messages about a 'missing
expected lexical'. I even tried editing the SQL statement but got the same
results. What's the trick to make MS Query rename the columns?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Query... can't see columns willwonka Excel Discussion (Misc queries) 0 August 30th 07 10:52 PM
Renaming Columns Peter Excel Discussion (Misc queries) 4 April 4th 06 07:12 AM
renaming columns Timewalker Excel Discussion (Misc queries) 2 February 10th 06 12:56 AM
Renaming Access Query used by Excel UEUC2 Excel Discussion (Misc queries) 1 December 13th 05 05:19 PM
Excel, renaming columns Treasuris Excel Worksheet Functions 1 September 27th 05 02:03 AM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"