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 2005 Forums
 Transact-SQL (2005)
 Update temp table

Author  Topic 

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2010-10-18 : 19:18:43

I have a temp table #TmpTable

tmp_ID INT,
bt1 BIT,
bt2 BIT,
bt3 BIT

The tmp_ID is populated, the bits are all set to 0

Now I have another table, MyTable
MyTable_ID
tmp_ID
MyINT

I need to go through all the rows in MyTable.
If MyINT = 3, update #TmpTable. Set bt3 = 1 where tmp_ID = tmp_ID

Trouble I am having is the best way to loop through MyTable.

Thanks,

Zath

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2010-10-18 : 19:43:58
Ok, I got it working!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-19 : 13:13:58
no need of loop. you can do batch updation itself using an UPDATE statement

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -