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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to create a view which have both tables data

Author  Topic 

RoniDxb
Starting Member

28 Posts

Posted - 2008-08-02 : 07:52:50
Table 1
A......B......C.............................
1......1......1.............................
2......2......2.............................
3......3......3.............................
Table 2
D......E......F.............................
6......6......6.............................
7......7......7.............................
Master View
A......B......C.....D......E......F............
1......1......1.....Null...Null...Null.........
2......2......2.....Null...Null...Null.........
3......3......3.....Null...Null...Null.........
Null...Null...Null..6......6......6............
Null...Null...Null..7......7......7............

plz guide me If it is possible to create a view which contains both tables data like i have mentioned above
it is just like a new table which have six column.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-08-02 : 09:44:15
[code]SELECT A, B, C, NULL AS D, NULL AS E, NULL AS F
FROM table1
UNION ALL
SELECT NULL AS A, NULL AS B, NULL AS C, D, E, F
FROM table2[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -