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)
 BULK UPDATE Script...

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-10 : 07:52:45
Jim Piller writes "Hello SQL Team!

I was wondering if you could point me in the direction of an example as to how to loop through a temp table containing updates and for each record in the temp table, find the appropriate record in the production table and update that record?

Thanks,

Jim Piller
I.T. Analyst
World Almanac Education"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-08-10 : 07:54:37
We can't do it in a loop, because we hate loops, but we can do it with a single UPDATE statement:

UPDATE A SET col1=B.col1
FROM ProductionTable A INNER JOIN #tempTable B ON A.ID=B.ID


Change the column names and JOIN condition to match your particulars.
Go to Top of Page
   

- Advertisement -