简体   繁体   中英

MS SQL - insert data from one Table into another using Trigger

I have few data's in Table_1 & want to insert the data into Table_2.

Is it possible to perform this operation using Trigger function in MS SQL?

Also I want this to data to insert into table_2 automatically in a specific time.

Can this be performed using SQL Trigger?

New to SQL...

Perhaps an instead of trigger could be of use?

CREATE TRIGGER [schema_name.] trigger_name
ON {table_name | view_name }
INSTEAD OF {[INSERT] [,] [UPDATE] [,] [DELETE] }
AS
{sql_statements}

Note though that you will have to insert into both tables in the trigger as you are "overriding" the standard INSERT .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM