update 表A set flag=1 where
(feature1='我')and (feature2='你') and (feature3='他') and (feature4 is null) and (feature5 is null)
(feature1='我')and (feature2='你') and (feature3='他') and (feature4 is null) and (feature5 is null)
调试欢乐多
(feature1='我')and (feature2='你') and (feature3='他') and (isnull(feature4,'')='') and (feature5 is null)
update 表A set flag=1 where
(feature1='我')and (feature2='你') and (feature3='他') and (feature4 IS NULL) and (feature5 IS null)
在创建一个表的时候,identity[(seed,increment)]定义该列为标识列。
请问标识列是什么意思,起什么作用。
update 表A set flag=1 where
(feature1='我')and (feature2='你') and (feature3='他') and (isnull(feature4,'')='') and (feature5 is null)
如果像上面那样处理的话,如果feature1,feature2,feature3,feature4,feature5的值均等于变量(而不是具体的值)
我们事先根本不知道feature4值是为空,这又要怎么办
(feature1=@变量1)and (feature2=@变量2) and (feature3=@变量3) and (feature4=@变量4) and (feature5=@变量5)
下面的变量值是从数据库表里循环取出来的,可能为空也可能不为空
变量1=空或某一个值;
变量2=空或某一个值;
变量3=空或某一个值;
变量4=空或某一个值;
变量5=空或某一个值;update 表A set flag=1 where
(feature1=@变量1)and (feature2=@变量2) and (feature3=@变量3) and (feature4=@变量4) and (feature5=@变量5)如果取出来的变量1,变量2,变量3,变量4,变量5均不为空的话,这样flag=1修改就成功了,要是某一个变量的值取出来的是空的话,用上面那句就不行了!
where (feature1=@变量1 or (@变量1 is null and feature1 is null))
and (feature2=@变量2 or (@变量2 is null and feature2 is null))
and (feature3=@变量3 or (@变量3 is null and feature3 is null))
and (feature4=@变量4 or (@变量4 is null and feature4 is null))
and (feature5=@变量5 or (@变量5 is null and feature5 is null))