Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in UNION ALL query

Status
Not open for further replies.

jobi

Technical User
Jun 30, 2000
24
0
0
NO
I create a view like this:

SELECT column
FROM table1
UNION ALL
SELECT column
FROM table2

I run the query, and everything looks OK. I see data, no errors.

When I try to save this view, I get this error:
"View definition includes no output columns or no items in the FROM clause."

Why do I get this error? The query works fine, and the SQL syntax is verified and OK. Is SQL2000 different from SQL7.0?
 
i tried this.. i got this error when i didnt select any columns from the tables.. why dont u try using an alias to specify the column name..
 
Can you post your exact view definition or SQL query?
 
I've tried to use alias too, but this has no effect.

This is actually the exact view definition, only with different column and table names.

And everything is OK in SQL 7.0. Is this a bug?
 
What service Pack are you on? Also, make sure that all of your columns have names.

Example:

select column1,count(*) as countall from tablea
UNION ALL
select column1,count(*) as countall from tableb

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top