Hi,
I'm running into a problem with the following query:
INSERT INTO NetScout.dbo.tb_Ref_App_Link(AppID,LinkID,Date,Vol ume)
SELECT NetScout.dbo.tb_Application.AppID, NetScout.dbo.tb_Link.LinkID, Date, Volume
FROM NetScout.dbo.tb_Application, NetScout.dbo.tb_Link, NetScout.dbo.[OLE DB Destination]
WHERE NetScout.dbo.tb_Application.AppName = NetScout.dbo.[OLE DB Destination].AppName
AND NetScout.dbo.tb_Link.LinkName = NetScout.dbo.[OLE DB Destination].LinkName
AND NetScout.dbo.tb_Application.AppID
NOT IN (SELECT NetScout.dbo.tb_Ref_App_Link.AppID
FROM NetScout.dbo.tb_Ref_App_Link)
AND NetScout.dbo.tb_Link.LinkID
NOT IN (SELECT NetScout.dbo.tb_Ref_App_Link.LinkID
FROM NetScout.dbo.tb_Ref_App_Link)
AND Date
NOT IN (SELECT Date
FROM NetScout.dbo.tb_Ref_App_Link)
I have a composite primary key in my "tb_Ref_App_Link" table, composed of LinkID, AppID, and Date. I want to check if the data i'm trying to insert already exists in the tb_Ref_App_Link table to avoid any referential integrity errors...
How do I say: If LinkID AND AppID AND Date all appear on the same line, then don't insert it...
Any help appreciated.