0
此SQL的最佳方式是什么?什么是此更新的最佳解决方案
A)
update tableName set
FieldA = (if FieldA = 1301 then null else FieldA endif),
FieldB = (if FieldB = 1301 then null else FieldB endif)
where Id = 707;
或
B)
update tableName set FieldA = null where Id= 707 and FieldA = 1301;
update tableName set FieldB = null where Id= 707 and FieldB = 1301;
在模型 “A” 我只有一个SQL的作品,并解决了这个问题,并且模型 “B” 我有两个SQL,与“A”模型做同样的事情,但更具可读性。
什么是最适合使用的模型?
我想知道即使当FieldA <> 1301时,第一个选项A)也不能触发更新触发器。甚至更新IO。我的意思是,引擎是否知道'更新设置FieldA = FieldA`会成为NOP? – pascal 2011-01-24 13:01:17