473,839 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Excel /myodbc drops column aliases (with joined tables)

With command-line interface ( 3.23.37, UNIX Socket ) all is well with
column aliasing. However, column aliases disappear in Excel, over
ODBC, when there are multiple (joined) tables in the query.

I run the following query with aliased columns with CLI:

select table1.c1 as 'pet category', table1.c2 as 'item', table1.c3 as
'quantity', table2.c2 as 'attendant' from table1 left outer join
table2 on (table1.c1=tabl e2.c1);
+--------------+--------+----------+------------+
| pet category | item | quantity | attendant |
+--------------+--------+----------+------------+
| dog | leash | 3 | Dan Miller |
| cat | collar | 5 | Kim Sloan |
| dog | collar | 4 | Dan Miller |
+--------------+--------+----------+------------+
3 rows in set (0.00 sec)

and all is well. The table1.c1 column is labeled as 'pet category',
table1.c2 as 'item', etc., etc.

But executing this same query in Excel ODBC my labels revert to the
original column names, and the aliases "peth category", "item",
....etc, are ignored:
c1 c2 c3 c2

Interestingly, though, Excel/MyODBC _retains_ column aliases for
single-table queries.

Is there some setting that can correct this? My
Edit->Options->"Qualify table names in SQL statement" box is grayed
out. So is the "Prodedures " button in the File->Execute SQL dialogue.

This phenomenon occurs in many versions of Excel, including 2000 and
97.

Thanks!

andrew
Jul 19 '05 #1
3 6057
After posting my message (quoted here) I discovered a case where Excel
drops the column alias with one table in the query. My query is

select schools.*, if( sid between 5000 and 6000, 1, 0) as 'do'
from schools
order by do, dist, name

Please note the "do" alias and the IF statement column it represents.
In this column a row is qualified (with either 1 or 0), based on the
IF condition, then the value is used in one of the sort levels (the
first one). The "order by" syntax lets you use the alias you've set
in the select clause...

I was happy to discover that aliases can be more than cosmetic - that
they can be as functional as allowing a sort otherwise impossible
(impossible without the alias).

And now I am suffering from this Excel alias omission problem where,
for a query such as above, the aliases get erased, and Excel tells me
"unknown column 'do' in order clause", after having wiped that which
it complains it can't find, from the select clause. Frustrating!

Any ideas?
thanks in advance


se*****@scssi.o rg (Andrew) wrote in message news:<a8******* *************** ****@posting.go ogle.com>...
With command-line interface ( 3.23.37, UNIX Socket ) all is well with
column aliasing. However, column aliases disappear in Excel, over
ODBC, when there are multiple (joined) tables in the query.

I run the following query with aliased columns with CLI:

select table1.c1 as 'pet category', table1.c2 as 'item', table1.c3 as
'quantity', table2.c2 as 'attendant' from table1 left outer join
table2 on (table1.c1=tabl e2.c1);
+--------------+--------+----------+------------+
| pet category | item | quantity | attendant |
+--------------+--------+----------+------------+
| dog | leash | 3 | Dan Miller |
| cat | collar | 5 | Kim Sloan |
| dog | collar | 4 | Dan Miller |
+--------------+--------+----------+------------+
3 rows in set (0.00 sec)

and all is well. The table1.c1 column is labeled as 'pet category',
table1.c2 as 'item', etc., etc.

But executing this same query in Excel ODBC my labels revert to the
original column names, and the aliases "peth category", "item",
...etc, are ignored:
c1 c2 c3 c2

Interestingly, though, Excel/MyODBC _retains_ column aliases for
single-table queries.

Is there some setting that can correct this? My
Edit->Options->"Qualify table names in SQL statement" box is grayed
out. So is the "Prodedures " button in the File->Execute SQL dialogue.

This phenomenon occurs in many versions of Excel, including 2000 and
97.

Thanks!

andrew

Jul 19 '05 #2
After posting my message (quoted here) I discovered a case where Excel
drops the column alias with one table in the query. My query is

select schools.*, if( sid between 5000 and 6000, 1, 0) as 'do'
from schools
order by do, dist, name

Please note the "do" alias and the IF statement column it represents.
In this column a row is qualified (with either 1 or 0), based on the
IF condition, then the value is used in one of the sort levels (the
first one). The "order by" syntax lets you use the alias you've set
in the select clause...

I was happy to discover that aliases can be more than cosmetic - that
they can be as functional as allowing a sort otherwise impossible
(impossible without the alias).

And now I am suffering from this Excel alias omission problem where,
for a query such as above, the aliases get erased, and Excel tells me
"unknown column 'do' in order clause", after having wiped that which
it complains it can't find, from the select clause. Frustrating!

Any ideas?
thanks in advance


se*****@scssi.o rg (Andrew) wrote in message news:<a8******* *************** ****@posting.go ogle.com>...
With command-line interface ( 3.23.37, UNIX Socket ) all is well with
column aliasing. However, column aliases disappear in Excel, over
ODBC, when there are multiple (joined) tables in the query.

I run the following query with aliased columns with CLI:

select table1.c1 as 'pet category', table1.c2 as 'item', table1.c3 as
'quantity', table2.c2 as 'attendant' from table1 left outer join
table2 on (table1.c1=tabl e2.c1);
+--------------+--------+----------+------------+
| pet category | item | quantity | attendant |
+--------------+--------+----------+------------+
| dog | leash | 3 | Dan Miller |
| cat | collar | 5 | Kim Sloan |
| dog | collar | 4 | Dan Miller |
+--------------+--------+----------+------------+
3 rows in set (0.00 sec)

and all is well. The table1.c1 column is labeled as 'pet category',
table1.c2 as 'item', etc., etc.

But executing this same query in Excel ODBC my labels revert to the
original column names, and the aliases "peth category", "item",
...etc, are ignored:
c1 c2 c3 c2

Interestingly, though, Excel/MyODBC _retains_ column aliases for
single-table queries.

Is there some setting that can correct this? My
Edit->Options->"Qualify table names in SQL statement" box is grayed
out. So is the "Prodedures " button in the File->Execute SQL dialogue.

This phenomenon occurs in many versions of Excel, including 2000 and
97.

Thanks!

andrew

Jul 19 '05 #3
After posting my message (quoted here) I discovered a case where Excel
drops the column alias with one table in the query. My query is

select schools.*, if( sid between 5000 and 6000, 1, 0) as 'do'
from schools
order by do, dist, name

Please note the "do" alias and the IF statement column it represents.
In this column a row is qualified (with either 1 or 0), based on the
IF condition, then the value is used in one of the sort levels (the
first one). The "order by" syntax lets you use the alias you've set
in the select clause...

I was happy to discover that aliases can be more than cosmetic - that
they can be as functional as allowing a sort otherwise impossible
(impossible without the alias).

And now I am suffering from this Excel alias omission problem where,
for a query such as above, the aliases get erased, and Excel tells me
"unknown column 'do' in order clause", after having wiped that which
it complains it can't find, from the select clause. Frustrating!

Any ideas?
thanks in advance


se*****@scssi.o rg (Andrew) wrote in message news:<a8******* *************** ****@posting.go ogle.com>...
With command-line interface ( 3.23.37, UNIX Socket ) all is well with
column aliasing. However, column aliases disappear in Excel, over
ODBC, when there are multiple (joined) tables in the query.

I run the following query with aliased columns with CLI:

select table1.c1 as 'pet category', table1.c2 as 'item', table1.c3 as
'quantity', table2.c2 as 'attendant' from table1 left outer join
table2 on (table1.c1=tabl e2.c1);
+--------------+--------+----------+------------+
| pet category | item | quantity | attendant |
+--------------+--------+----------+------------+
| dog | leash | 3 | Dan Miller |
| cat | collar | 5 | Kim Sloan |
| dog | collar | 4 | Dan Miller |
+--------------+--------+----------+------------+
3 rows in set (0.00 sec)

and all is well. The table1.c1 column is labeled as 'pet category',
table1.c2 as 'item', etc., etc.

But executing this same query in Excel ODBC my labels revert to the
original column names, and the aliases "peth category", "item",
...etc, are ignored:
c1 c2 c3 c2

Interestingly, though, Excel/MyODBC _retains_ column aliases for
single-table queries.

Is there some setting that can correct this? My
Edit->Options->"Qualify table names in SQL statement" box is grayed
out. So is the "Prodedures " button in the File->Execute SQL dialogue.

This phenomenon occurs in many versions of Excel, including 2000 and
97.

Thanks!

andrew

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
732
by: Andrew | last post by:
With command-line interface ( 3.23.37, UNIX Socket ) all is well with column aliasing. However, column aliases disappear in Excel, over ODBC, when there are multiple (joined) tables in the query. I run the following query with aliased columns with CLI: select table1.c1 as 'pet category', table1.c2 as 'item', table1.c3 as 'quantity', table2.c2 as 'attendant' from table1 left outer join table2 on (table1.c1=table2.c1);...
3
2023
by: bawar | last post by:
Hey, I can say I belong to the newbies in this subject. I own my own website with mySQL-databases, but now I have to show one table of those mySQL-databases in an excel worksheet. It is the intention that the user opens the excel-file trough the browser, so I hope there does not have to be installed anything on the clients machine... (I looked at that MyODBC but I don't understand it 100 % yet, I'm newbie hey). It would be very nice if...
9
8904
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save this out of an XML file or Excel Template file. Next I need to convert a dataset to xml and try and transform this data into the users xml file..........i've seen a few things on this but havent had much success...
3
1571
by: Geir Baardsen | last post by:
Hi! From one of my manufacturers I get new prices in an excel spreadsheet. Now I want to import this data to my access db. However, there is a difference: The items in MyAccess.db (tblItems) are like: OIL hy-123456789 and the items in NewPrices.xls are like: OIL 123456789.
0
2825
by: acharyaks | last post by:
Hi life saver, I am using excel component for the development. The purpose is to connect to excel through the odbc connection string. Then through the connection extract data into a dataset and then save the data into a client machine (Intranet) as excel page using the excel component (using Excel = Microsoft.Office.Interop.Excel;) in the code. Please help me. I have wasted so many days on this.
0
4715
by: Peter | last post by:
I am having a problem reading an Excel file that is XML based. The directory I am reading contains Excel files that can be of two types. Either generic Microsoft based or XML based. I am reading the Microsoft based files with an OleDbDataAdapter. Then filling the contents of the first worksheet into a dataset. However when I try to add the XML based file to my dataset using an XmlTextReader I can never seem to get it to save to a...
4
2306
by: Bernie Yaeger | last post by:
I use the following writexml method to convert a dataset/datatable to .xml: ds.WriteXml(mstrpath, XmlWriteMode.WriteSchema) ds.WriteXmlSchema(mstrpathxsd) The path strings are simple full paths: eg, f:\emapps\xmlfiles\filename.xml (or .xsd as appropriate). I get an xml file, but there are 2 problems:
1
4573
by: Eric E | last post by:
Hi, I'm trying to write a recordset-returning function that returns a values from a base table, and one column from a joined table, where the joined table varies according to a field of the base table. I'm looking for an efficieint way to do this, and I don't think I know enough about Postgres' capabilities to know how to do this. I imagine fetching my base table rows in order of the table reference column, looping over my base table,...
1
9781
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping to export two Tables (or queries...not sure which to use - they both seem to have the same data) in...
7
12084
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
9855
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10908
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10587
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10649
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10295
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.