如何设置触发器以对表执行操作。 [英] How to set trigger to perform an operation on table.

查看:185
本文介绍了如何设置触发器以对表执行操作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ms sql server中有一个表。我想设置触发器,每当今天完成时,列IsActive设置为false。或MaxNotification& MaxArticles& MaxVideos& MaxEvent = 0设置IsActive = false。

我将如何实现这一目标...请帮助...





I have a table in ms sql server. I want to set trigger that whenever today is finishdate the column IsActive is set to false. or MaxNotification & MaxArticles & MaxVideos & MaxEvent = 0 Set IsActive = false.
How would i achieve this...please help...


Create Table TblSubscription
(
SubscriptionId int identity(1,1) Primary key,
UserId INT NOT NULL Foreign key References TblUser(UserId),
PackageId INT NOT NULL Foreign key References TblPackages(PackageID),
ConstID INT NOT NULL Foreign key References TblConstituency (ConstID),
StartDate datetime,
FinishDate datetime,
MaxNotification int,
MaxArticles int,
MaxVideos int,
MaxEvent int,
MaxAllias int,
Cost float,
IsActive bit,
IsPaid bit
);

推荐答案

参考:触发器 - SQL Server [ ^ ]


这篇关于如何设置触发器以对表执行操作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆