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

  • SEARCH
  • Home
  • 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 8004613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:58:06+00:00 2026-06-04T16:58:06+00:00

I am trying to get records inbetween two dates, however when I run the

  • 0

I am trying to get records inbetween two dates, however when I run the SQL I get the following error:

Operand type clash: datetime2 is incompatible with int

SELECT M.Id, M.MTimeInt, M.Date, CAST(D.Name AS TEXT) as Name 
FROM C 
JOIN N ON C.N_Id=N.Id 
JOIN M ON M.N_Id=N.Id 
JOIN MDish ON MDish.M_Id=M.Id 
JOIN D ON D.Id=MDish.D_Id 
WHERE C.Id=110 AND M.Date BETWEEN 2012-05-28 AND 2012-06-08

The SQL looks correct, but I can’t seem to figure out why it is complaining, any idea?

Thanks

  • 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-06-04T16:58:07+00:00Added an answer on June 4, 2026 at 4:58 pm

    Try:

    BETWEEN '2012-05-28' AND '2012-06-08'
    

    Otherwise it’s 2012 minus 05 minus 28, which equals 1979 and is an integer and not a date.

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

Sidebar

Related Questions

I'm trying to get records between 2 dates. The dates are entered in the
I'm trying to get my linq statement to get me all records between two
I'm trying to get the top N records for each unique row of data
I'm trying to get the top N records (when ordered by some column X),
I am trying to get all the prime(row) numbered records from my table.Can someone
I'm trying to get all records with date greater then now. I tried this
I am trying to get the all records which are 2 hours or more
I want to get records from sql server 2005 in datetime format like this
I'm trying to get the last 7 records from a table whose records were
I am trying to get several records by composite index from a table having

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.