473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

UNION statement doesn't work


Hi,

I have a database stored in MS SQL 2000 and an application written in
VB5, which connects the database via JET/ODBC.

I have a problem with the UNION statement.

When I run a simple query like:

"SELECT field1 FROM table1 UNION SELECT field2 FROM table2"

I get the following error:

"Runtime error 3078 - The Microsoft Jet database engine cannot find the
input table or query 'select field1 from table1'. Make sure it exists
and that its name is spelled correctly."

I can run the queries separately "SELECT field1 FROM table1" and "SELECT
field1 FROM table2", so that I'm sure table and field names are correct
and I have permission to access them.

Both field1 and field2 are the same type (int).

If I run the query in MS SQL Query Analyzer, it works fine.

It doesn't work only when I run it from VB/JET/ODBC.

Has anyone already had this kind of problem?

Any help will be highly appreciated!

Thank you so much for the attention.
--
Posted via http://dbforums.com
Jul 20 '05 #1
1 4649

"loRdK" <me*********@dbforums.com> wrote in message
news:33****************@dbforums.com...

Hi,

I have a database stored in MS SQL 2000 and an application written in
VB5, which connects the database via JET/ODBC.

I have a problem with the UNION statement.

When I run a simple query like:

"SELECT field1 FROM table1 UNION SELECT field2 FROM table2"

I get the following error:

"Runtime error 3078 - The Microsoft Jet database engine cannot find the
input table or query 'select field1 from table1'. Make sure it exists
and that its name is spelled correctly."

I can run the queries separately "SELECT field1 FROM table1" and "SELECT
field1 FROM table2", so that I'm sure table and field names are correct
and I have permission to access them.

Both field1 and field2 are the same type (int).

If I run the query in MS SQL Query Analyzer, it works fine.

It doesn't work only when I run it from VB/JET/ODBC.

Has anyone already had this kind of problem?

Any help will be highly appreciated!

Thank you so much for the attention.


Isn't Jet Access related? Are you sure the database is SQL Server? If so, is
your ODBC DSN defined correctly?

Ron.
--
Performance Intelligence, Inc.
Spy 4 DB2 - http://www.pireporting.com/spy4db2.html

Jul 20 '05 #2

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

Similar topics

10
by: KENNY L. CHEN | last post by:
Dear experts, I have two tables in my Oracle 8i database: TEST (COL1,COl2,REC_NO) and TEST1 (COL1,COL2,REC_NO). Both tables are unique-indexed on (COL1,COL2,REC_NO). I think the following...
1
by: Adrian | last post by:
Dear All I've come across a strange issue when using UNION via MyODBC on my Fedora linux box (I'm using MySQL 4.1.3-standard-beta) **This doesn't work: (select a from tbl_name where a=10...
5
by: Thomas Baxter | last post by:
Is it possible to have a conditional union statement in a stored proc? Here's an example on the northwind database. If says there's a syntax error near the UNION statement. Looks like it...
3
by: Paradigm | last post by:
I am using Access 2K as a front end to a MYSQL database. I am trying to run a Union query on the MYSQL database. The query is (much simplified) SELECT as ID from faxdata UNION SELECT as ID ...
4
by: Elroyskimms | last post by:
Using SQL 2000... tblCustomer: CustomerID int CompanyName varchar(20) HasRetailStores bit HasWholesaleStores bit HasOtherStores bit tblInvoiceMessages:
7
by: urban.widmark | last post by:
Hello We are having some problems with triggers, sequences and union all in V8 on code that worked fine in V7. Was wondering if someone else has seen this and/or knows what to do. A trigger...
8
by: wkaras | last post by:
In my compiler, the following code generates an error: union U { int i; double d; }; U u; int *ip = &u.i; U *up = static_cast<U *>(ip); // error I have to change the cast to...
7
by: KoliPoki | last post by:
Hello every body. I have a small issue. Problem: I have a table with 4 descriptor columns (type). I need to formulate a query to retrieve a count for each type so I can group by...etc. The...
2
by: jafastinger | last post by:
I have a large union. If I break it into its individual parts they all run quick. The longest is the last select it takes 2 minutes to fetch all rows. When I run the query below it does not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.