回覆列表
  • 1 # 使用者1498558830685

    建立一個表

    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

    )

    第一次寫 有點緊張

  • 中秋節和大豐收的關聯?
  • 睡覺前在肚子上裹保鮮膜有作用嗎?