Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combine multiple tables sql2k 1

Status
Not open for further replies.

mttorpy

MIS
Feb 26, 2004
29
US
I am tring to combine about ten table that contain phonenumbers. Is union the best way to do it or is there a better way? Also what is the best way to store the phone numbers nchar/float ect...? This is what I am tring but it is not working:

create table animaster
as
select ani
from dbo.AM
union
select ani
from dbo.APCC
union
select ani
from dbo.BSPC

Any help? Thanks
 
Hello friend,
Use the Select ... Into statement to create your table as shown below.

select ani INTO animaster
from dbo.AM
union
select ani
from dbo.APCC
union
select ani
from dbo.BSPC

However if you want to create the table first and then populate it later, in that case U create the table using the Create table statement eg: Create table animaster(ani varchar(50))
then populate the table:
Insert into Animaster
select ani from dbo.AM
union
select ani
from dbo.APCC
union
select ani
from dbo.BSPC
As for the datatype of the phone number column I will recommend you to use varchar. nChar is a unicode datatype, use unicode datatype ONLY IF your table will store characters from different alphabets.

Enjoy
Bertrandkis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top