一條SQL語句

hdslah 2003-10-21 10:03:19
update tblcontract_son set
case
when isnull(field1,'')='' then field2=200
when isnull(field1,'')<>'' then field1=200
end
where bh=21

象這種SQL語句如何實現﹐以上的要求就是可在一條SQL語句里實現有條件的修改﹐在二條語句實現不要。
...全文
37 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengdali 2003-10-21
  • 打赏
  • 举报
回复
update tblcontract_son set field2=case when isnull(field1,'')='' then 200 else field2 end, field1=case when isnull(field1,'')='' then 200 else field1 end where bh=21
txlicenhe 2003-10-21
  • 打赏
  • 举报
回复
update tblcontract_son set field2 = (case when isnull(field1,'') = '' then 200 end),field1 = (case when isnull(field1,'') <> '' then 200 end)
where bh = 21

22,206

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧