Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello Friends,I have a Table1(10 columns) in which if a record is inserted, then immediately that same record needs to be inserted in Table2 with only 4 columns. I am new to this Trigger concept.Please help/guide me with a sample Trigger.THanks in Advance.Thanks in AdvanceShilpa
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts
Posted - 2010-08-17 : 09:53:32
Something like this
SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TRIGGER [dbo].[TABLEA_TRIG_INSERT]ON [dbo].[TABLEA]FOR INSERTASBEGIN INSERT INTO TABLEB ( COL1, COL2, COL3, COL4 ) SELECT COL1, COL2, COL3, COL4 FROM InsertedEND
Shilpa22
Starting Member
37 Posts
Posted - 2010-08-18 : 02:34:41
Thank you vijayisonly. It resolved my issue.Thanks in AdvanceShilpa