Invalid alias name

J

Jeff

We are running office 2003 and office 2000 in our office. I have a union
query that I am using and it works fine on 2003 but I get an invalid alias
name error when I run it on the 2000. It looks like this:
SELECT "Z-1", [Z-1] as Choice,[NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-2", [Z-2], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-3", [Z-3], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-4", [Z-4], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-5", [Z-5], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-6", [Z-6], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-7", [Z-7], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-8", [Z-8], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-9", [Z-9], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-10", [Z-10], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-11", [Z-11], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-12", [Z-12], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-13", [Z-13], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-14", [Z-14], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-15", [Z-15], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-16", [Z-16], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-17", [Z-17], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-18", [Z-18], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-19", [Z-19], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-20", [Z-20], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL SELECT "Z-21", [Z-21], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data];

Can anyone tell me why this will not work in 2000? Thanks! Jeff
 
A

Allen Browne

The first field is a literal. Try giving it an alias, e.g.:
SELECT "Z-1" AS TheSource, ...

I'm surprised you got that many UNIONs to work.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Jeff said:
We are running office 2003 and office 2000 in our office. I have a union
query that I am using and it works fine on 2003 but I get an invalid alias
name error when I run it on the 2000. It looks like this:
SELECT "Z-1", [Z-1] as Choice,[NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-2", [Z-2], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-3", [Z-3], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-4", [Z-4], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-5", [Z-5], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-6", [Z-6], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-7", [Z-7], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-8", [Z-8], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-9", [Z-9], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-10", [Z-10], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-11", [Z-11], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-12", [Z-12], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-13", [Z-13], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-14", [Z-14], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-15", [Z-15], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-16", [Z-16], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-17", [Z-17], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-18", [Z-18], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-19", [Z-19], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL
SELECT "Z-20", [Z-20], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data]
UNION ALL SELECT "Z-21", [Z-21], [NAME (LAST)],[NAME
(FIRST)],[FSD],[PLANT],[TRADE],[SKILLED DATE]
FROM [Voluntary Flowback Survey Data];

Can anyone tell me why this will not work in 2000? Thanks! Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top