select *
from testdatetrigger t
join inserted i
on ((i.ValidTo >= t.ValidFrom) and (i.ValidFrom <= t.ValidTo))
Where not (i.ValidTo=t.Validto and i.ValidFrom=t.ValidFrom)
This can be applied to the numbers as well.
Please refer the link
http://stackoverflow.com/questions/4023160/prevent-inserting-overlapping-date-ranges-using-a-sql-trigger
No comments:
Post a Comment