回覆列表
  • 1 # 使用者2648403161863

    建立一個表

    CREATE TABLE [dbo].[RoomMessage](

    [roomID] [nchar](10) NOT NULL,

    [Name] [nchar](10) NULL,

    [Phone] [nchar](20) NULL,

    [State] [bit] NOT NULL

    ) ON [PRIMARY]

    GO

    建立一個觸發器

    create TRIGGER TRG_RoomState_Change

    ON RoomMessage

    AFTER update

    AS

    BEGIN

    SET NOCOUNT ON;

    update RoomMessage

    set Name = null

    ,Phone = null

    where exists(

    select *

    from inserted i

    where i.State = 0

    and i.roomID = RoomMessage.roomID

    )

    第一次寫 有點緊張

  • 中秋節和大豐收的關聯?
  • 看南大張鳳陽老師的哪些書比較好?