這是我的示例和我的要求。我使用SQL Server 2012的如果存在SQL Server 2012減少位值
declare @nMyBitValue bigint = 32
update MyTabl1
set MyBitValue = case
when MyBitValue & @nMyBitValue <> 0
then MyBitValue - @nMyBitValue
else MyBitValue
end
where Id = 1
現有數據MyBitValue
列是48,@nMyBitValue = 32
。
現在如果3234的值存在於MyBitValue
中,那麼這個值應該從MyBitValue
列中減去。
我減少了我的價值MyBitValue - @nMyBitValue
。但是有沒有其他辦法可以減少我的價值?
? –
SQL Server 2012 –
你的要求對我來說還不清楚! - 正如我所看到的:當'@ nMyBitValue'等於'0'時,你想更新'MyBitValue'字段!,這是嗎? ;) –