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)
 Create View Union

Author  Topic 

friscapjtn
Starting Member

8 Posts

Posted - 2009-09-02 : 02:52:46
Hello,

I've got a strange problem. I can't create a view with a query containing a UNION statement.

e.g:

create view test as
select a.name, a.telephone, a.birthday, b.address, b.status,
c.divisi
from test1 a left outer join test2 b on a.id = b.id
left outer join test3 c on a.id = c.id


how i can union this view test with test1 and test2?




Hmmm....

Sachin.Nand

2937 Posts

Posted - 2009-09-02 : 03:35:48
Does it give any error?

PBUH
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-02 : 04:01:15
I don't see any union in your create statement and I don't see any reason for an union.
Could you explain more clear please?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-02 : 04:23:24
Note that the number of columns and datatypes should match if you use UNION or UNION ALL

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -