Doubt in Query - SQL Server 2005 -


i having table 100 columns. here 50 60 columns contains null value in it. need replace null value 0 in 50 60 columns. tried update query as,

update [tablename]  set col1=0, col2 = 0, ... col60 = 0  col1 null , col2 null ... col60 null 

is there anyother query update these 60 columns without specifying such columns or have other approach???

you have specify columns, can skip clause , have 1 update deal them @ once:

update [tablename] set   col1=coalesce(col1, 0),   col2=coalesce(col2, 0),   col3=coalesce(col3, 0),   col4=coalesce(col4, 0),   [...] 

Comments