L
lynu
Unregistered / Unconfirmed
GUEST, unregistred user!
SQLServer2000中文版,MDAC2.7
我在一個表中建一個約束,
輸入1)([Color1] is null or [Color1] = '') or ([Color1] <> [Color2] and [Color1] <> [Color3])
保存后SQLServer自動優化為
([Color1] is null or [Color1] = '' or [Color1] <> [Color2] and [Color1] <> [Color3])
結果無效,一條記錄不符合條件也錄入進去了
然后我刪除他,重新建一個約帶
(2)([Color1] <> [Color2] and [Color1] <> [Color3]) or ([Color1] is null or [Color1] = '')
保存后SQLServer自動優化為
([Color1] <> [Color2] and [Color1] <> [Color3] or ([Color1] is null or [Color1] = ''))
結果測試正確,輸了與上條測試完全相同的數據,約束條件起作用了
我拷!我看了半天,也不明白
([Color1] <> [Color2] and [Color1] <> [Color3]) or ([Color1] is null or [Color1] = '')
與
([Color1] is null or [Color1] = '') or ([Color1] <> [Color2] and [Color1] <> [Color3])
有什么不同?
我在一個表中建一個約束,
輸入1)([Color1] is null or [Color1] = '') or ([Color1] <> [Color2] and [Color1] <> [Color3])
保存后SQLServer自動優化為
([Color1] is null or [Color1] = '' or [Color1] <> [Color2] and [Color1] <> [Color3])
結果無效,一條記錄不符合條件也錄入進去了
然后我刪除他,重新建一個約帶
(2)([Color1] <> [Color2] and [Color1] <> [Color3]) or ([Color1] is null or [Color1] = '')
保存后SQLServer自動優化為
([Color1] <> [Color2] and [Color1] <> [Color3] or ([Color1] is null or [Color1] = ''))
結果測試正確,輸了與上條測試完全相同的數據,約束條件起作用了
我拷!我看了半天,也不明白
([Color1] <> [Color2] and [Color1] <> [Color3]) or ([Color1] is null or [Color1] = '')
與
([Color1] is null or [Color1] = '') or ([Color1] <> [Color2] and [Color1] <> [Color3])
有什么不同?