我正在使用 SQL Server 2008 并有以下触发器:
USE [gatordata]
GO
/****** Object: Trigger [dbo].[TriggerUserAssigned] Script Date:2/20/2016 3:42:05 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[TriggerUserAssigned]
ON [dbo].[User]
AFTER UPDATE
AS
IF UPDATE([AssignedToUser])
BEGIN
declare @Id int;
declare @AssignedToUser nvarchar(50);
declare @TimeStamp datetime;
declare @Hour bit;
declare @RushService bit;
declare @Status nvarchar(50);
select @Id=i.Id from inserted i;
select @AssignedToUser=i.AssignedToUser from inserted i;
select @Hour=i.[Hour] from inserted i;
select @RushService=i.[RushService] from inserted i;
select @Status=i.[Status] from inserted i;
INSERT …Run Code Online (Sandbox Code Playgroud) 我需要根据ColumnA的值更改ColumnB的状态.像伪代码那样的东西:"当ColumnA ='True'然后ColumnB ='警告'ELSE ColumnB时的情况"
我正在使用Azure SQL Server.