|
楼主 |
发表于 2012-7-12 08:57:34
|
显示全部楼层
----------不知道有没有人试过,本人所写的这个代码有点小失误,现在把修改后的奉上。
CREATE TRIGGER [dbo].[TransVouchs_ssk_1] --新建触发器名称
ON [dbo].[TransVouchs] ----表名
AFTER INSERT,UPDATE -----触发条件为:INSERT,UPDATE
AS
BEGIN
if
(select bwhpos from TransVouch,Warehouse,(select MAX(ctvcode)as ctvcode from TransVouch)as a where TransVouch.cTVCode=a.ctvcode and TransVouch.cOWhCode=Warehouse.cwhcode)='1'
-----------判断调拨单上的转出仓库是否有货位管理
BEGIN
if(select count(*) from TransVouchs,TransVouch,Warehouse
where TransVouchs.id=TransVouch.id and TransVouch.cOWhCode=Warehouse.cwhcode and bwhpos='1' and coutposcode is NULL)<>'0'
--------------判断调拨单子表转出仓库的货位是否填入
BEGIN
select * from 转出仓库货位不能为空
----------------执行报错语句
end
end
if (select bwhpos from TransVouch,Warehouse ,(select MAX(ctvcode)as ctvcode from TransVouch)as a where TransVouch.cTVCode=a.ctvcode and TransVouch.cIWhCode=Warehouse.cwhcode)='1'
-----------判断调拨单上的转入仓库是否有货位管理
begin
if(select count(*) from TransVouchs,TransVouch,Warehouse
where TransVouchs.id=TransVouch.id and TransVouch.cIWhCode=Warehouse.cwhcode and bwhpos='1' and cinposcode is NULL)<>'0'
--------------判断调拨单子表转入仓库的货位是否填入
BEGIN
select * from 转入仓库货位不能为空
----------------执行报错语句
end
end
end |
|