jeudi 26 novembre 2015

How to use a computed column in an if/else

I got a problem with my trigger: It wont recognize my table that stores the computed column that I need the data from.

My table looks like this and consists of multiple computed columns: my table

My problem is with the In_Months column, part of my trigger looks like this:

CREATE TRIGGER [Balance_monthly]
ON [dbo].[Balance]
FOR INSERT, UPDATE
AS
BEGIN
    DECLARE @test int;
    DECLARE @amount int;
    SET NOCOUNT ON

    IF In_Months % 12 = 0
        SET @amount = 3;

It doesn't allow me to Update my trigger because it can't find my table.

Aucun commentaire:

Enregistrer un commentaire