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 2000 Forums
 Transact-SQL (2000)
 How to append records from one table to another?

Author  Topic 

frank2
Starting Member

35 Posts

Posted - 2005-11-11 : 14:28:27
I have a table MyTable which contains no records.
. Primarykey – int (identity)
. CoName – varchar

I have a second table CoNames which contains 500 records
. Code – varvhar
. CompanyName – varchar

The 500 records in CoNames there are 100 unique names.

How do I copy only the unique names from CoNames table into the empty MyTable table?

Thanks

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2005-11-11 : 15:01:06
insert into mytable (coname)
select distinct companyname
from coname

or something like that, i've done it a million times. u should hav been able to find the answer to that question on this site without having to wait for an answer from any of us
Go to Top of Page

frank2
Starting Member

35 Posts

Posted - 2005-11-11 : 15:07:42
That did it. thank you
Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2005-11-11 : 15:12:19
no worries

if you wanna learn some cool stuff, check this out
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210
Go to Top of Page
   

- Advertisement -