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)
 TSQL beginner

Author  Topic 

aidanh
Starting Member

1 Post

Posted - 2004-02-18 : 07:31:21
Hi i'm trying to do something very simple, but I cant work out how.

If I have two tables "a_t" and "b_t" both with colum "c_id"

in table "b_t" I have colum "the_name"

I add a colum "the_name" to "a_t"

I now want to fill in colum "the_name" in "a_t" with the entries from "b_t". The tables are linked by "c_id". However there are no relations

how can I do this using TSQL?

if anyone can help that would be great :)

aidanh

nr
SQLTeam MVY

12543 Posts

Posted - 2004-02-18 : 08:18:57
>> The tables are linked by "c_id". However there are no relations
Not sure what that means.

Why do you want to do this?

update a_t
set the_name = b_t.the_name
from a_t
join b_t
on b_t.c_id = a_t.c_id

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -