I am very new to SQL, wondering if there is a way;
Scenario: User uploads photo into one table via field on frontend. I need photo to go to another Table for another component i am using. Photo is now master photo on both components .
CREATE TABLE junk (id int); CREATE TABLE junk1 (id int); IF OBJECT_ID ('someTrigger', 'TR') IS NOT NULL DROP TRIGGER someTrigger; GO CREATE TRIGGER someTrigger ON junk AFTER INSERT AS INSERT INTO junk1 SELECT id FROM inserted; -- Gets value from insert. GO INSERT INTO junk VALUES (123); SELECT * FROM junk; -- Confirms insert. SELECT * FROM junk1; -- Confirms trigger fired.
Are the tables under the same database? If not, use Import/export to copy the table contents from one table to another from source DB to Target DB. Even if they are from the same database, you can use the same specifying the source and target table names