sql - Hard trigger/constraints making -


i'm new database , have question table triggers or maybe check constraint. i'm using sql server mangagement studio.

i have following table:

create table item(     startprice        char(5)          not null,     description       char(22)         not null,     start_date        char(10)         not null,     end_date          char(10)         not null,     indicator         char(3)          not null 

);

what i'm trying make trigger/constraint rule: indicator "no" if system date earlier start_date , end_date, , "yes" if system date after start_date.

this simple have use trigger before insert option -

following trigger go in oracle db -

create or replace trigger  item_insert_indicator  before delete on item  each row  begin if  :new.start_date > sysdate , :new.end_date > sysdate     :new.indicator := 'no'; elsif :new.start_date < sysdate    :new.indicator := 'yes'; end if; end; 

this reference. database can change keywords accordingly.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -