database - SQL Server Trigger using IF statements -


how go writing trigger when insertion particular table has been made, checks attribute based on condition , append text attribute. how go implementing if logic this?

    create table sometable (       table_id number(5) not null       paragraph varchar(50)     );     create trigger append_text on sometable     after insert          begin       /*pseudocode: if table_id = 5 append text "mark watney" paragraph*/       end      go 

you need create instead of insert trigger:

create trigger append_text on sometable instead of insert  begin      insert sometable     select table_id, paragraph + case when table_id = 5 ' mark watney' else '' end      inserted end  go 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -