I have created a INSERT script, but I need to add to it now before it does the INSERT to check if that particular @Employeeid already has another BIDid record on the table that startdate and enddate conflict with the new BIDid, startdate, and enddate being added.How can I go about doing this check before inserting the new record?DECLARE @Employeeid varchar(20)DECLARE @BidID INTDECLARE @Startdate SMALLDATETIMEDECLARE @Enddate SMALLDATETIMEINSERT INTO DetailPBS.tblEmployeeBidPeriodhistVALUES(@Employeeid, @BidID,@Startdate, @Enddate, 0, 0,NULL, NULL, 1)
heres the table thats getting inserted into. (DetailPBS.tblEmployeeBidPeriodhist)Employeeid Bidid EmpStartdate EmpEnddate Manuallychanged RemovedfromBid Lastupdatedby Lastupdatedatetime ManuallyAddedToBid124843 8 2012-12-17 2012-12-31 0 0 NULL NULL 0128252 8 2012-07-01 2012-12-31 0 0 999 2013-01-28 0128280 8 2012-07-01 2012-12-31 0 0 999 2013-01-28 01330160 8 2012-07-01 2012-12-31 0 0 NULL NULL 0200459 8 2012-07-01 2012-12-31 0 0 999 2013-01-28 0201280 8 2012-10-27 2012-12-31 0 0 NULL NULL 0201456 8 2012-07-01 2012-12-31 0 0 999 2013-01-28 0