using UNION with SELECT * in sql server 2005

      I have two identical temp tables and i want to amalgamate the contents of both into one table.
Is it possible to do a UNION using SELECT *
or do i have to explicitly list every column in each table?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
using SELECT * is possible, but ONLY if both tables have the same column count and the same data types in the same positions.
however, it's usually not a good idea to have such thing in a prod application, except some rare situations

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ephraim WangoyaCommented:

Yes you can do it so long as the number of fields are the same in the two tables
blossomparkAuthor Commented:
Hi angellll and ewangoya
thanks for your quick's late in the evening and i got to get  this report out before i can go home,,,so thanks for giving me hope!! :-)
blossomparkAuthor Commented:
that worked a treat...thanks again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.