I have a trigger that I want to do the following...
create calc trigger on tblPIW_DB1
instead of update
as
begin
declare @x money, @y money
select @x= isnull(i.[Acq Price],0), @y= isnull(i.[Over Head],0),... from inserted i
UPDATE dbo.[tblPIW_DB1] SET
[Acq Price] = @x,
[Over Head] = @y,
.......
FROM inserted i
WHERE dbo.[tblPIW_DB1].[prop_num] = i.[prop_num]
Basically if the field is null i want to fill the column with a '0'. But its not doing that, it just stays null when i update the table. What am i doing wrong? The dots mean it have more fields than that in the query and update.
create calc trigger on tblPIW_DB1
instead of update
as
begin
declare @x money, @y money
select @x= isnull(i.[Acq Price],0), @y= isnull(i.[Over Head],0),... from inserted i
UPDATE dbo.[tblPIW_DB1] SET
[Acq Price] = @x,
[Over Head] = @y,
.......
FROM inserted i
WHERE dbo.[tblPIW_DB1].[prop_num] = i.[prop_num]
Basically if the field is null i want to fill the column with a '0'. But its not doing that, it just stays null when i update the table. What am i doing wrong? The dots mean it have more fields than that in the query and update.