Question
How can I alter the SQL code below to ensure that the inserts into "dbo.tblBootStrapperInstruments" only occur if they don’t already exist?
Code
INSERT INTO dbo.tblBootStrapperInstruments (CCY, Instrument, Tenor)
SELECT CCY,Instrument,Gridpoint FROM dbo.Feed_Murex_Intraday_DF mx WHERE NOT EXISTS
(SELECT * FROM dbo.tblBootStrapperInstruments bs
WHERE bs.CCY = mx.CCY
AND bs.Instrument = mx.Instrument
AND bs.Tenor = mx.Gridpoint)
Here’s how I’d do it.