if exists (select top 1 1 from A where col1=1) begin update A with(rowlock) set col2=0 end
UPDATE 表 SET 另一列=0 WHERE 一列='C01' 是这个意思?
不是很清楚你的需求意思,给你两个版本 if exists (select top 1 1 from A where col1=‘c01’) begin update A with(rowlock) set col2=0 where col1=‘c01’ end版本二 if exists (select top 1 1 from A where col1=‘c01’) begin update A with(rowlock) set col2=0 end
select ... case ... when 计算列
begin
update A with(rowlock) set col2=0
end
SET 另一列=0
WHERE 一列='C01'
是这个意思?
if exists (select top 1 1 from A where col1=‘c01’)
begin
update A with(rowlock) set col2=0 where col1=‘c01’
end版本二
if exists (select top 1 1 from A where col1=‘c01’)
begin
update A with(rowlock) set col2=0
end