标题:help----sql server 触发器
只看楼主
小白黑脸怪
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-9-30
 问题点数:0 回复次数:0 
help----sql server 触发器
CREATE TRIGGER  [dbo].[tigger_update]
   ON  [UFTData231275_000002].[dbo].[SA_SaleDelivery]
   AFTER update
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    declare @saledeliveryorder nvarchar(50)
    select @saledeliveryorder=[SourceVoucherCode] from [UFTData231275_000002].[dbo].[SA_SaleDelivery]
    declare @id int
    select top 1 @id=[id]  FROM [UFTData231275_000002].[dbo].[SA_SaleOrder_b] order by [id] desc
    declare @saleorder nvarchar(50)
     select @saleorder=[code] from [UFTData231275_000002].[dbo].[SA_SaleDelivery] where [ID]= ( select [idSaleOrderDTO]  FROM [UFTData231275_000002].[dbo].[SA_SaleOrder_b] where [id]=@id)
    declare @s nvarchar(50)
    select  @s=[code] from [UFTData231275_000002].[dbo].[SA_SaleDelivery] where [SourceVoucherCode]=@saledeliveryorder
    update [UFTData231275_000002].[dbo].[SA_SaleOrder_b] set [priuserdefnvc1] =@s where [id]=@id
END
GO
创建数据库之后没什么就不能修改数据了
搜索更多相关主题的帖子: SELECT server from where SET 
2019-09-30 14:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-497081-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.106950 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved