Insert into MSSQL database if teh record does not already exist
Posted on 2014-04-10
i have a .net application and i am trying to insert a value only if it does not already exist in teh table but every timei run it get get duplicated data
sql.CommandText = " insert into CC_eCollegeTermIDList (TermCode,TermPart,eCollegeTermIDWebBased,eCollegeTermIDWebEnhanced,UpdatedUser,DateUpdated) Values " & " (@Term, @TermPart,'','','AutomatedSystem',@DateUpdate)" & _
" Select @Term,@TermPart Where not exists(select * from CC_eCollegeTermIDList where TermPart = @TermPart and TermCode = @Term)"