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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:16:04+00:00 2026-05-23T07:16:04+00:00

The conversion of a char data type to a datetime data type resulted in

  • 0

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

When I run the SQL query on my desktop machine, its fine. No errors or anything. However, when I execute the same code on the server that will be running it, it fails.

I’ve determined this is the section of SQL causing the issue. DateOfRun is a DateTime field.

 ,(SELECT intField
    FROM tableA
    WHERE RowIdentifier= ParentTable.RowIdentifier
            AND DateOfRun = Convert(Varchar(10),ParentTable.OfferOutcomeDateTime,120)) AS Days

Why would this work on one machine, but not the other?

  • 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-23T07:16:04+00:00Added an answer on May 23, 2026 at 7:16 am

    That’s definitively odd and likely to do with regional settings but its like the old joke

    A man goes to a doctor’s office. He
    says, “Doctor, it hurts when I raise
    my arm over my head.” The doctor
    replies, “Then don’t raise your arm
    over your head.”

    So don’t do that. Do this instead

    WHERE RowIdentifier= ParentTable.RowIdentifier
              AND DateOfRun = 
               DATEADD(DAY, DATEDIFF(DAY, 0, ParentTable.OfferOutcomeDateTime), 0) 
    

    Its the best way to go see Thomas’ answer to Most efficient way in SQL Server to get date from date+time?

    Then it will work regardless of regional settings because it never gets represented as a string

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

Sidebar

Related Questions

The conversion of a char data type to a DateTime data type resulted in
I am writing a data conversion in PL/SQL that processes data and loads it
SQL Server 2005 Question: I'm working on a data conversion project where I'm taking
I have this query that runs fine: SELECT Value FROM data WHERE MetaDataID =
Microsoft SQL Server 2008 (SP1), getting an unexpected 'Conversion failed' error. Not quite sure
I'm just starting out with x64 compilation. I have a couple of char*'s, and
When I run this in sql server2005 I got error. select * from productratedates
I have a SQL table with a date field defined as char(8), or 20090609,
Could anyone help me understand why the following query works fine in SQL 2000
While working with COM in C++ the strings are usually of BSTR data type.

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.