Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

how to Check data after Insert Trigger

$
0
0

Hi friends,

I need to insert data from one database table to another database table by after Insert trigger. Now

I need to check whether that another database table already have the data or not. If there already have the data then do some exception but not show error.

CREATE TRIGGER [dbo].[TRIG_TABLE1] 
ON [dbo].[Table1] AFTER INSERT AS
BEGIN
    INSERT INTO Table2(CustID,DateCreated,DateModify)
    SELECT CustID, DateCreated, DateModify
    FROM INSERTED
END

I have done this far but can not check whether the table already have the data or not. Please solve this problem.

Thanks  in advance.


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>