【发布时间】:2014-01-15 05:43:49
【问题描述】:
我在 SQL Server 2008 中有一个表。在网页中用 0 插入这些列
列:
id (identity)
enero (decimal) --inserts 0 convert to null
febrero (decimal)--inserts 0 convert to null
marzo (decimal) --inserts 0 convert to null
abril (decimal) --inserts 0 convert to null
etc..
CREATE TRIGGER Pone
ON Rf_Egr_Meses
AFTER INSERT, UPDATE
AS
BEGIN
--
SET NOCOUNT ON;
--i don't know hoy compare if are 0 and what row
update Rf_Egr_Meses set ene=null , feb=null, mar=null where ()
END
GO
由于某些原因,我无法更改插入 0 的网页。
在一个表中,我想创建一个触发器,将值从 0 转换为 null(仅当值为 0 时)
有什么创建触发器的想法吗?
【问题讨论】:
-
我创建了一个触发器,但我不知道如何更新插入的行并比较列是否为 0
-
谢谢我编辑,对不起,我只是创建触发器我很新手
标签: sql-server sql-server-2008 tsql triggers