We face the problem to do some time based or reservation , to check whether the time slot is available or not.
This script will help to do it better and quicker.
Declare @mytable table (id int,fromtime smalldatetime,totime smalldatetime)
insert into @mytable values (1,'2009-08-20 08:00:00','2009-08-20 12:00:00')
if not exists (select 'x' from @mytable where '2009-08-20 07:00:00' between fromtime and totime)
begin
print 'Insert statement'
End
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.