Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
patsymcox
Starting Member
2 Posts |
Posted - 2010-01-30 : 12:21:44
|
| I need a stored procedure for a report which will query 3 tables, for egselect a1,a2 from table aselect b1,b2,b3 from table bselect c1,c2 from table cIs there any way to create a temporary table with fields a1,a2,b1,b2,b3,c1,c2 and fetch data into the temporary table and return it. so I get a uniform data structure as result set rather than multiple result sets.Plz help |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-01-30 : 12:28:22
|
| [code]SELECT a1, a2, NULL AS b1, NULL AS b2, NULL AS b3, NULL AS c1, NULL AS c2 FROM TableAUNION ALLSELECT NULL AS a1, NULL AS a2, b1, b2, b3, NULL AS c1, NULL AS c2 FROM TableBUNION ALLSELECT NULL AS a1, NULL AS a2, NULL AS b1, NULL AS b2, NULL AS b3, c1, c2 FROM TableC[/code] |
 |
|
|
patsymcox
Starting Member
2 Posts |
Posted - 2010-01-30 : 22:59:04
|
| Thanks much. It helped! |
 |
|
|
|
|
|
|
|