Shivanand Bhangari
asked on
How to merge all multiple tables with a single blank table in SQL?
There are multiple tables, all tables are having same column names with different values, nd I have created one new table with same columns , but I want to put those all data in this new crated single table in SQL. There is no unique id in any of the table. I just want to merge all table data in one sinlge table.
Table names are - Andra Pradesh, Arunachal Pradesh, Assam, Bihar, Chhattisgarh,Delhi,Hariyan a,Himachal Pradesh, Karnataka.
And all column names are same in all the tables , here is the column names - State, District,Year,January,Febr uary,March ,April,May ,June,July ,August, September, October, NovemberDe cember. And tbl_India this is the new table which I created with the same columns.... I want to add those all data in this new table.
Table names are - Andra Pradesh, Arunachal Pradesh, Assam, Bihar, Chhattisgarh,Delhi,Hariyan
And all column names are same in all the tables , here is the column names - State, District,Year,January,Febr
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here it is ! Enjoy !
--
--
INSERT INTO TableName [Cols]
SELECT [col_name] FROM tablea
UNION ALL
SELECT [col_name] FROM tableb
--
--
Hi!
Depending on the overall data-size of all the tables you want to merge into the new table.
If the size is over 5 million records then I strongly recommend that you partition the table in such way that you have near-even distribution and the partitioning benefits most or all queries that access the table.
Regards,
Tomas Helgi
Depending on the overall data-size of all the tables you want to merge into the new table.
If the size is over 5 million records then I strongly recommend that you partition the table in such way that you have near-even distribution and the partitioning benefits most or all queries that access the table.
Regards,
Tomas Helgi
ASKER