Deleted and inserted are logical (concept) tables.
Source: Internet
Author: User
Conceptual deleted and inserted are logical (conceptual) tables. These tables are structurally similar to the tables that define the triggers (that is, the tables in which the user action is attempted), which holds the old or new values of the rows that the user operation might have changed. For example, to retrieve all the values in the deleted table, use:
SELECT *from deletedcreate TRIGGER tr_lkcrm_sqjbxxins
ON dbo. Lkcrm_sqsp_sqjbxx
For INSERT
As
BEGIN
DECLARE cur_lkcrm_sqjbxxins CURSOR for SELECT INS. Sqxh,ins. Dyxh,ins. SQLB from INSERTED INS
DECLARE @SQXH INT
DECLARE @DYXH INT
DECLARE @SQLB NVARCHAR (2)
OPEN Cur_lkcrm_sqjbxxins
FETCH NEXT from Cur_lkcrm_sqjbxxins into @SQXH, @DYXH, @SQLB
While @ @FETCH_STATUS = 0
BEGIN
IF @SQLB = ' OR @SQLB = ' 04 '
UPDATE lkcrm_dd_ddxx SET sptgbz= ' 0 ' WHERE ddxh= @DYXH
ELSE
BEGIN
IF @SQLB = ' 02 '
UPDATE lkcrm_dd_thdxx SET sptgbz= ' 0 ' WHERE thdxh= @DYXH
ELSE
BEGIN
IF @SQLB = ' 03 '
UPDATE lkcrm_sc_schdjl SET sptgbz= ' 0 ' WHERE hdxh= @DYXH
End
End
FETCH NEXT from Cur_lkcrm_sqjbxxins into @SQXH, @DYXH, @SQLB
End
Close Cur_lkcrm_sqjbxxins deallocate cur_lkcrm_sqjbxxins
End
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.