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 6322701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:22:57+00:00 2026-05-24T16:22:57+00:00

I have two varchar(30), startDate and endDate coloumn and it has dates values and

  • 0

I have two varchar(30), startDate and endDate coloumn and it has dates values and also nulls in that coloumn. I want to compare the date range in sql server 2005/2008. someting like

WHERE e2.type=1
   AND coloumn1 between convert(datetime,startDate,101) and convert(datetime,endDate,101)

When i try to execute it gives me an error
the conversion of varchar data type to a datetime data type resulted in an out-of-range value.

  • 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-24T16:22:58+00:00Added an answer on May 24, 2026 at 4:22 pm

    That error message indicates that the value stored in the varchar cannot be converted (by SQL) into a datetime. You will need to drill down in your data and locate the problem row(s), which can be a tricky thing to do. Start with something like:

    SELECT StartDate, isdate(StartDate)
     from MyTable
     where StartDate is not null
      and isdate(StartDate) = 0
    

    …and the same for EndDate. You will have to play around with this, as string-to-date conversion is can get tricky fast. (Needless to say, you would be much better off storing datetime values as datetime values. If you can change your table structure, do so!)

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

Sidebar

Related Questions

I have a table which has two varchar(Max) columns Column 1 Column 2 -----------------------
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
SCENARIO: I have two tables, table1(col1 date) and table2(col2 varchar(20)). REQUIREMENT: Whenever anyone updated
Given that I have two tables Customer (id int, username varchar) Order (customer_id int,
I have two tables that I want to query and merge based on a
I have a table rental: rentalId int(11) Customer_customerId int(11) Vehicle_registrationNumber varchar(20) startDate datetime endDate
I have two tables. T1 has one column which has 9000 unique records (varchar).
I have two varchar fields which store the date and time in the following
I have two tables in a MySql DB: items id (char) name (varchar) description
I have two tables. table_x: id INT(11) tag INT(11) table_tags: id INT(11) name VARCHAR(255)

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.