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)
 copy part of a table to another

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-12 : 18:51:57
Allen writes "I have two tables in the same DB (Microsoft SQL 2000)

One table has primary data, the other has one column I want to update the primary table with on each row. Each have a student ID that will match up

I can't get it to work and I don't know if I have my syntax right

UPDATE studentid313 INNER JOIN studentid313update
ON studentid313.studentid = studentid313update.studentid
SET studentid313.homeroom = studentid313update.homeroom
WHERE studentid313.studentid = studentid313update.studentid"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-09-12 : 19:13:13
UPDATE s
SET homeroom = u.homeroom
FROM studentid313 s
INNER JOIN studentid313update u
ON s.studentid = u.studentid


Tara Kizer
Go to Top of Page
   

- Advertisement -