Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default SQL: custom names of columns when using IIF (excel quering access database)

Hi all,

I am creating in Excel (via data/import new external data/new
database query) a query from MS Access database using statement IIF,
but excel ignore my column names (... AS 'custom name'...) and use
artificial ones (e.g. expr1002,expr1003 etc)

My code looks like:

SELECT table1.persID AS 'ID personal',
table1.surname+' '+table1.name AS 'Full name' ,
IIF ((select top 1 tbl2.order from tbl2 tbl2
where table1.year_ID = tbl2.year_ID and
tbl2.PID = table1.PID and
tbl2.order is not null
)is null
, null
, (select top 1 tbl2.order from tbl2 tbl2
where table1.year_ID = tbl2.year_ID and
tbl2.PID = table1.PID and
tbl2.order is not null)
) as 'Order'
FROM table1 table1

I want to have table with columns 'ID personal', 'Full name' and
'Order', but I recieve fine data with funny column names. What is
wrong?

Thank you for any hint.

riso

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default SQL: custom names of columns when using IIF (excel quering access database)

Not knowing your tables, I can't help much. But one thing -- use
brackets rather than quotes to enclose field names with spaces, e.g.
AS [ID personal]

Hth,
Merjet


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
Update Excel Database via Access Main Database with a script Finnbar New Users to Excel 2 November 3rd 08 07:24 PM
Excel(2007) crashes on quering for DrawingObjects selection ranga Excel Programming 1 January 23rd 07 02:57 PM
Excel Spreadsheet from Access. List of names changes as names are Gordy w/Hi Expectations Excel Discussion (Misc queries) 1 October 21st 05 03:30 AM
Return MS-SQL database names to excel? No Name Excel Programming 2 October 7th 04 09:54 AM


All times are GMT +1. The time now is 08:23 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"