|
藍森林 http://www.lslnet.com 2006年7月08日 11:08
如何寫這個觸發器?
某表AA的某個字段F1允許為空,當插入紀錄時判斷新插入的紀錄的F1會不會和現有紀錄的 F1 (非空)重複??
我寫了
create trigger ti_aaa for insert as
....
if update(F1)
BEGIN
if exists (select1 from AA A, inserted b where a.F1 = B.F1 AND B.f1 is not null)
BEGIN
raiseerror 10101, '重複'
END
END
但是只要插入 的紀錄F1非空,都提示'重複', 實際上並不重複 |
沒有辦法解決?
? |
| |