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)
 [Resolved] Combine query updates

Author  Topic 

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2009-03-19 : 14:37:33
Is it possible to combine these updates into one?

update #Combined_LaborHrsDetailTable 
set eqemployeehours = Null where eqemployeehours = 0.00

update #Combined_LaborHrsDetailTable
set eqequipmenthours = Null where eqequipmenthours = 0.00

update #Combined_LaborHrsDetailTable
set jdeemployeehours = Null where jdeemployeehours = 0.00

update #Combined_LaborHrsDetailTable
set jdeequipmenthours = Null where jdeequipmenthours = 0.00

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-19 : 14:58:13
[code]update #Combined_LaborHrsDetailTable
set eqemployeehours = NULLIF(eqemployeehours,0.00),
jdeemployeehours =NULLIF(jdeemployeehours,0.00),
eqequipmenthours=NULLIF(eqequipmenthours,0.00),
jdeequipmenthours=NULLIF(jdeequipmenthours,0.00)
where eqemployeehours = 0.00
OR eqequipmenthours = 0.00
OR jdeemployeehours = 0.00
OR jdeequipmenthours = 0.00
[/code]
Go to Top of Page
   

- Advertisement -