Sql server 许多更新->;一次更新?

Sql server 许多更新->;一次更新?,sql-server,updates,Sql Server,Updates,每个月我们都会收到一个来自另一家公司的文件,我们需要将它调整到我们的数据库中(在SQL Server中)。为此,我们运行了几个需要很长时间的更新 有没有办法将所有这些更新“转换”为一条语句,使其只在表中运行一次?(这张桌子真大!) 我们现在正在使用类似的东西: update Table1 set column01 = 0 where column01 = ' ' or column01 = ''; update Table1 set column02 = 0 where column02 = '

每个月我们都会收到一个来自另一家公司的文件,我们需要将它调整到我们的数据库中(在SQL Server中)。为此,我们运行了几个需要很长时间的更新

有没有办法将所有这些更新“转换”为一条语句,使其只在表中运行一次?(这张桌子真大!)

我们现在正在使用类似的东西:

update Table1 set column01 = 0 where column01 = ' ' or column01 = '';
update Table1 set column02 = 0 where column02 = ' ' or column02 = '';
update Table1 set column03 = 0 where column03 = ' ' or column03 = '';
update Table1 set column04 = 0 where column04 = ' ' or column04 = '';
update Table1 set column05 = 0 where column05 = ' ' or column05 = '';
update Table1 set column06 = 0 where column06 = ' ' or column06 = '';
update Table1 set column07 = 0 where column07 = ' ' or column07 = '';
update Table1 set column08 = 0 where column08 = ' ' or column08 = '';
update Table1 set column09 = 0 where column09 = ' ' or column09 = '';
update Table1 set column10 = 0 where column10 = ' ' or column10 = '';
update Table1 set column11 = 0 where column11 = ' ' or column11 = '';
update Table1 set column12 = 0 where column12 = ' ' or column12 = '';
update Table1 set column13 = 0 where column13 = ' ' or column13 = '';
update Table1 set column14 = 0 where column14 = ' ' or column14 = '';
update Table1 set column15 = 0 where column15 = ' ' or column15 = '';
update Table1 set column16 = 0 where column16 = ' ' or column16 = '';
update Table1 set column17 = 0 where column17 = ' ' or column17 = '';
update Table1 set column18 = 0 where column18 = ' ' or column18 = '';
update Table1 set column19 = 0 where column19 = ' ' or column19 = '';

您可以使用
CASE。。。当
像这样

update Table1 set 
    column01 = CASE when column01 = ' ' or column01 = '' then 0 ELSE column01 END,
    column02 = CASE when column02 = ' ' or column02 = '' then 0 ELSE column02 END,
......
    column19 = CASE when column19 = ' ' or column19 = '' then 0 ELSE column19 END