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 2008 Forums
 Transact-SQL (2008)
 how to check date duration in the table

Author  Topic 

jimmy2090
Starting Member

26 Posts

Posted - 2013-06-28 : 08:10:21
i am facing problem to check the date duration in the same table

Visitor_Name Company Date_In Date_Out
Alibaba ABC_Company 01-Jun-13 30-Jun-13
Alibaba ABC_Company 02-Jun-13 28-Jun-13


as data above, how to prevent the second record been insert into the same table as the same duration even different date.

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-06-28 : 09:00:40
By creating a unique constraint on Visitor_Name column, will make sure not to duplicate the vistor again in the table

Cheers
MIK
Go to Top of Page

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-06-28 : 09:30:32
What if the Date_Out of the second one is 03-Jul-13?

djj
Go to Top of Page
   

- Advertisement -