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)
 Virtually Append Tables

Author  Topic 

rohcky
Starting Member

38 Posts

Posted - 2010-02-15 : 14:32:09
Is there a way to append or concatenate 2 identical tables? I have a table that have over 100 billion records that had to be split in 2. Is there a way to virtually append these 2 tables back together using a SQL query?

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-02-15 : 15:08:43
Sure.. One option is to use UNION or UNION ALL.
Go to Top of Page

rohcky
Starting Member

38 Posts

Posted - 2010-02-15 : 15:35:35
How did I forget that? Thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-16 : 00:58:12
most often when you need to merge couple of tables together virtually the approach is to define a view that combines data from both using union or union all

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-16 : 02:08:49
If the two (new) tables are logically split you may want to create the View in the correct manner for a Horizontal Partition - that way any query that accesses the table will be optimised (to only access the one table that actually contains the data).

In fact, for 100 billion rows, I would have thought you should have 100 tables (or so!!) in a horizontal partition view
Go to Top of Page
   

- Advertisement -