【发布时间】:2013-06-25 12:17:37
【问题描述】:
ALTER
TRIGGER [tgr_del_into_plan_audit]
ON [dbo].[agent_plan_details]
AFTER DELETE
AS
declare @plan_title_id int;
declare @plan_title varchar(50);
declare @no_of_property_listing int;
declare @validity_of_plan int;
declare @Each_property_listing_life int;
declare @list_of_property_in_search_result int;
declare @price decimal(8,2);
declare @discount BIT;
declare @discount_code varchar(10);
declare @discount_percentage int
select @plan_title_id=d.plan_title_id from deleted d;
select @plan_title=d.plan_title from deleted d;
select @no_of_property_listing=d.no_of_property_listing from deleted d;
select @validity_of_plan=d.validity_of_plan from deleted d;
select @Each_property_listing_life=d.Each_property_listing_life from deleted d;
select @list_of_property_in_search_result=d.list_of_property_in_search_result from deleted d;
select @price=d.price from deleted d;
select @discount=d.discount from deleted d;
select @discount_code=d.discount_code from deleted d;
select @discount_percentage=d.discount_percentage from deleted d;
BEGIN
SET NOCOUNT ON
INSERT INTO agent_plan_details_audit
( plan_title_id,
plan_title,
no_of_property_listing,
validity_of_plan,
Each_property_listing_life,
list_of_property_in_search_result,
price,
discount,
discount_code,
discount_percentage,
create_date,
action )
VALUES
(@plan_title_id,
@plan_title,
@no_of_property_listing,
@validity_of_plan,
@Each_property_listing_life,
@list_of_property_in_search_result,
@price,
@discount,
@discount_code,
@discount_percentage,
GETDATE(),
'D')
END
【问题讨论】:
-
这是什么数据库系统?触发器没有标准化,
sql标记用于标准 SQL 语言。另外,既然您已经编写了一个部分工作的触发器,那么代码在哪里? -
向我们展示您的触发器。 :)
-
如果您发布当前代码,我们或许可以修复它。
-
什么样的行?网格行? HTML表格行? SQL 行?
-
@jlafay
sql被标记。 ;)
标签: sql sql-server