I have two tables, creds and users.
users
email password fullName contact city
creds
email password
I need a trigger which can copy email
and password
from users
into creds
upon insertion of new rows.
I have two tables, creds and users.
users
email password fullName contact city
creds
email password
I need a trigger which can copy email
and password
from users
into creds
upon insertion of new rows.
Hope this following trigger works for you. More or less it will be like this
CREATE TRIGGER user_trigger
ON creds
FOR INSERT
AS
BEGIN
Insert into users(email, password, fullname, contact, city)
select distinct u.email, u.password
from inserteduser u
left join creds c
on u.email = c.email and u.password = c.password
END;