I need to write a trigger that rounds a value whenever it is inserted/updated into a table
+1
A:
DECLARE @tt TABLE (id INT NOT NULL PRIMARY KEY, value NUMERIC(10, 0) NOT NULL)
INSERT
INTO @tt
VALUES (1, 3.1415926)
SELECT *
FROM @tt
, without any triggers.
Quassnoi
2010-03-15 13:51:52
+1
A:
Here is a getting started tutorial on how to use Triggers in SQL Server. Start working on it and let us know if you have any issues.
Teja Kantamneni
2010-03-15 13:52:32
I ended up going with this as the answer because I did have to use a trigger, the reason being we're allowing users to use sql scripts to insert into the table and they're too lazy to round their own values (it's a price column), so we want to do it automatically.
Bmw
2010-03-21 16:28:54