An example of a trigger

xiaoxiao2021-03-06  62

Now I am doing a customer service system. . The theory and structure are like this. . . . Customer table kh_name [varchar] (8) list_date [datetime] has item table ID [int] WP [varchar] (20) report_date [datetime] has a list kh_name wp_id wp list_date When the customer table adds a record, it is judge whether or not the current time is Within Monday to Friday, if it is within the scope, look up the item table, find out in the weekly released product inserted into the list. . The release date of items in items is edited to be edited on Monday (one week, row down) Create Trigger Hual on khfor INSERTASINSERT YL (kh_name, list_date, wp_id, wp) SELECT KH.KH_NAME, KH.LIST_DATE, WP.ID, WP .wpfrom kh, wpwhere datename (weekday, kh.list_date) Not in ('Saturday ",' Sunday ') - This is not (Monday - Friday) will not insert data and datepart in a list of notches (WK, Kh.list_date) = datepart (wk.wp.report_date) - This sentence indicates the same number, indicating that (Sunday ----- Saturday) is the same week

转载请注明原文地址:https://www.9cbs.com/read-111622.html

New Post(0)