当前位置: 代码迷 >> Sql Server >> mssql的update应该如何写
  详细解决方案

mssql的update应该如何写

热度:38   发布时间:2016-04-24 20:21:37.0
mssql的update应该怎么写?
以下是我需求(如果两者不同则赋值,否则就不做赋值操作)
表:table;列:a;参数:@a
if(a<>@a) set a = @a
else
   return

ps:不要用一下方法:
update table
        set a = @a
where XXX
这个无论a是否等于@a它都会赋值。

------解决方案--------------------
其實用update也是沒有問題的
update table
set a = @a
where a <> @a
  相关解决方案