deleted和inserted是逻辑(概念)表。

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
deletedinserted是逻辑概念)表。这些表在结构上类似于定义触发器的表(也就是在其中尝试用户操作的表);这些表用于保存用户操作可能更改的行的旧值或新值。例如,若要检索deleted表中的所有值,请使用:
SELECT*FROMdeletedCREATETRIGGERTR_LKCRM_SQJBXXINS
ONdbo.LKCRM_SQSP_SQJBXX
FORINSERT
AS
BEGIN
 DECLARECUR_LKCRM_SQJBXXINSCURSORFORSELECTINS.SQXH,INS.DYXH,INS.SQLBFROMinserted INS
 DECLARE@SQXHINT
 DECLARE@DYXHINT
 DECLARE@SQLBNVARCHAR(2)

 OPENCUR_LKCRM_SQJBXXINS
 FETCHNEXTFROMCUR_LKCRM_SQJBXXINSINTO@SQXH,@DYXH,@SQLB
 
 WHILE@@FETCH_STATUS=0
 BEGIN
  IF@SQLB='01'OR@SQLB='04'
   UPDATELKCRM_DD_DDXXSETSPTGBZ='0'WHEREDDXH=@DYXH
  ELSE
  BEGIN
   IF@SQLB='02'
    UPDATELKCRM_DD_THDXXSETSPTGBZ='0'WHERETHDXH=@DYXH
   ELSE
   BEGIN
    IF@SQLB='03'
     UPDATELKCRM_SC_SCHDJLSETSPTGBZ='0'WHEREHDXH=@DYXH
   END
  END
  FETCHNEXTFROMCUR_LKCRM_SQJBXXINSINTO@SQXH,@DYXH,@SQLB
 END
 CLOSECUR_LKCRM_SQJBXXINSDEALLOCATECUR_LKCRM_SQJBXXINS
END

 


 
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
个人分类: 数据库
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭