อยากจะให้ Table member coloums Sub2ID แก้ไขตามไปด้วย ตอนนี้เขียน Trigger แบบนี้แต่ยังไม่ได้
Code
CREATE TRIGGER Upsup2
ON SysSub2
AFTER INSERT,UPDATE
AS
BEGIN
DECLARE @LinkID as nvarchar(200);
DECLARE @ID as nvarchar(200);
SELECT @LinkID = LinkID, @ID = ID FROM inserted
UPDATE SysMember SET Sub2ID = @LinkID WHERE Sub2ID = @ID
END
รบกวนหน่อยนะคร้าบ ขอบคุณ คร้าบ
Tag : .NET, Ms SQL Server 2014, Win (Windows App), VB.NET
CREATE TRIGGER Upsup2
ON SysSub2
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @LKID NVARCHAR(200);
DECLARE @NEWLKID NVARCHAR(200);
SET @LKID = (SELECT LinkID FROM DELETED)
SET @NEWLKID = (SELECT LinkID FROM INSERTED)
UPDATE [dbo].[SysMember]
SET [Sub2ID] = @NEWLKID
WHERE [Sub2ID] = @LKID
END