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

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -