I have the following Trigger. I have not figured out how to write it properly including null and "0" values.
The Triggers need is to populate the LEFT_ODD Column with a 1(True) if the L_F_ADD is an ODD Number.
My problem is when i insert a new record into the table i do not populate the L_F_ADD, L_T_ADD, R_F_ADD, and R_T_ADD columns right away it may sit as a "null" or "0" value for a couple days. If its a null value i would like it to be changed to "0" as you fire dispatch system does not like "nulls".
I would like this trigger to do both functions for me. First Change the null value to a "0" then popluate the LEFT_ODD column if the L_F_ADD is a odd number.
/****** Object: Trigger [dbo].[LeftODD_Update] Script Date: 01/09/2013 09:25:43 ******/
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
ALTER TRIGGER [dbo].[LeftODD_Update]
AFTER INSERT, UPDATE
SET SEGMENT.Left_ODD = 1
WHERE (([L_F_add] % 2) = 1) OR
([L_F_add] = 0 AND [R_F_add] > 0 AND ([R_F_add]%2) = 0));
---OR ELSE IF [L_F_add] = null make it '0'
--OR IF [L_T_add] = null make it '0'
--IF [R_F_add] = null make it '0'
--IF [R_T_add] = null make it '0'