SQL: trigger update

Source: Internet
Author: User
Alter trigger [update_tts_hotel_master] on [DBO]. [tts_1__name] After update -- insert, update, deleteas -- column-Level Trigger: whether the hotel name if (Update (h_name) Begin update tts_1__masterset tts_1__master.hm_hname = inserted is updated. h_namefrom tts_cmd_master, insertedwhere tts_cmd_master.hm_hid = inserted. h_idend

 

 Alter   Trigger   [  Modify_tts_orderremark  ]  On   [  DBO  ] . [ Tts_order_log  ]  For   Insert , Update  As  Declare   @ Row   Int  Select   @ Row  =  @ Rowcount  If   @ Row  =  0  Return  If ( Exists ( Select   1   From  Inserted ))  Begin         Update H1 Set Tts_orderremark =   Isnull (H1.tts _ orderremark, '' ) +   Convert ( Varchar ( 16 ), Getdate (), 120 ) +  '  |  '  +  Cast (H2.tts _ Username As   Nvarchar ( 20 )) + '  |  '  +  Cast (H2.tts _ orderremark As   Nvarchar ( 300 )) +  '  ☆  '   From Tts_order_total As H1, inserted As H2Where H1.tts _ orderid =  H2.tts _ orderid  End 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.