Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6999501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:32:58+00:00 2026-05-27T20:32:58+00:00

I have a event table that has the following columns: StartDate datetime EndDate datetime

  • 0

I have a event table that has the following columns:

StartDate datetime
EndDate datetime
StartTime nvarchar(10)
EndTime nvarchar(10)

Let’s say a record has these values in the table:

StartDate: 2011-12-22 00:00:00.000
EndDate: 2011-12-22 00:00:00.000
StartTime: 4:00 PM
EndTime: 5:00 PM

Now, if someone comes to schedule an event, I need to make sure he can’t schedule it for the same time or between the start and end times of this existing event.

So, he can schedule from 5:00 PM to 6:00 PM or from 11:00 AM to 4:00 PM but not 11:00 AM to 5:00 PM or 4:30 PM to 5:00 PM.

How can I check for this? I know this isn’t the best design for this table, but I have to stick to this design, else we will have to change a lot of middle layer and client side code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:32:59+00:00Added an answer on May 27, 2026 at 8:32 pm

    Try this

    declare @apptDate DATETIME
    
    SET @apptDate = '12/22/2011 4:30PM'
    select COUNT(*) 
    from t1
    where @apptDate Between
    CAST( StartDate+StartTime as DateTime) and CAST( EndDate+EndTime as DateTime)  
    
    SET @apptDate = '12/22/2011 6:30PM'
    select COUNT(*) 
    from t1
    where @apptDate Between
    CAST( StartDate+StartTime as DateTime) and CAST( EndDate+EndTime as DateTime)  
    

    If count(*) > 0, an appointment exists. If not, the spot is free

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a table in my database called Orders that has the
i have a table that has event name and event date. if i want
I have a table called Event. A column has duration--which is...how long that event
I have a table which has columns of data that contain status. Two example
This question requires some hypothetical background. Let's consider an employee table that has columns
I have a table that functions as an event log and stores the users
So I have a parent that defines a onmouseup event that hide/display a table.
I have another rather curious problem. I have the following structure: CREATE TABLE [dbo].[Event]
I have the following data model: Camp -> CampEvent <- Event. Camp has CampId
I have the following entities. User Event Expense Guest A User is someone that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.