Click here to Skip to main content
15,891,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to union two table with different data-types
Posted
Comments
Maciej Los 15-May-12 9:45am    
We need more details. We can't read in your mind...

Will this do:
SQL
SELECT 
   table1ColA AS COL1,
   table1ColB AS COL2,
   "" AS COL3,
   "" AS COL4
FROM 
   Table1

UNION

SELECT 
   "" AS COL1,
   "" AS COL2,
   table2ColA AS COL3,
   table2ColB AS COL4
FROM 
   Table2 
 
Share this answer
 
v2
Comments
Maciej Los 15-May-12 10:05am    
Good answer, my 5!
Sandeep Mewara 15-May-12 10:24am    
Thanks losmac.
VJ Reddy 15-May-12 10:34am    
Thoughtful answer for a question with minimum info. 5!
Sandeep Mewara 15-May-12 11:48am    
Thanks :)
Use CAST or CONVERT. Also, if you shared your code we could help more. See here.[^]
 
Share this answer
 
Comments
madhusudhan.k 25-May-12 8:10am    
His ques was, with different data types
( I think no need of more details on quen)
good ans of ryanb31, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900