Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Date Overlap trigger test with singel query.

Author  Topic 

sneethling
Starting Member

22 Posts

Posted - 2001-03-07 : 06:48:19
I need an "If exists" Test which will indicate whether a singel Inserted record's date range is overlapping with other records in the same table.
There is two types of tests.
1. Date_From is part of the Primary Key
2. Date_From is NOT part of the Primary Key.

Use the following table deffinition to show me a trigger (Insert or Update).

SAMPLE_TABLE1
ID_NR1 int Primary Key,
ID_NR2 char(5) Primary Key,
DATE_FROM smalldatetime,
DATE_TO smalldatetime

SAMPLE_TABLE2
ID_NR1 int Primary Key,
ID_NR2 char(5) Primary Key,
DATE_FROM smalldatetime Priamry Key,
DATE_TO smalldatetime

Remember that DATE_TO can have a null value.

The Error message must be : "Date period overlaps with one or more period(s)"

Can some one HELP please.... !!!
   

- Advertisement -