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
 General SQL Server Forums
 New to SQL Server Programming
 UNION Vs UNION ALL

Author  Topic 

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-04-22 : 10:23:54
Hi All,

I am doing a UNION of 8 views(with 3 million rows in each view approx). I am sure that there is NO DUPLICATE data between the views. SO specifying a UNION ALL would be better than specifying a UNION in this case?

Thanks!

Prakash.P
The secret to creativity is knowing how to hide your sources!

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-04-22 : 10:26:13
yes.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-22 : 10:30:25
Did you look at all 24 million rows?

In any case, what do you consider dups?

In any case, are you making this a view of views as well?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-04-22 : 10:33:39
I am doing a

Select *,1 from View1
Union all
Select *,2 from View2

etc., So I am sure that wont be any dups!

Yes - i am creating a view from Views!

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-22 : 10:34:43
I bet the 8 source views derives from same table.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-22 : 10:43:24
quote:
Originally posted by Peso

I bet the 8 source views derives from same table.



E 12°55'05.25"
N 56°04'39.16"


]

Point being, you should probably just go against the tables

And SELECT *, n is such bad form

http://weblogs.sqlteam.com/brettk/archive/2004/04/22/1272.aspx




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-04-22 : 11:54:50
okay let me explain the scenario,

We are migrating a SQL 2000 Analysis Services to SSAS. The existing design has 8 different partitions(filled through 8 different views) for last 8 quarters. The calculations for each quarter differs and hence we have 8 different views.

Now I could have tried bringing in all the data together but we dont have the time for it. So instead of specifying 8 different fact tables in SSAS, I am trying to bring all the data inside the view and then specify a slicer condition. I am not sure if my explantion makes sense but I can explain in detail if needed.

Thanks for your replies!

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page

vital
Starting Member

12 Posts

Posted - 2008-04-23 : 01:51:18
hi all whats diffecult about inner join and union(all)?
are they like same things?

thanks.
Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-04-23 : 01:57:17
Please go through basics of JOINS. UNION and JOINS are entirely different concepts.

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page
   

- Advertisement -