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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:08:21+00:00 2026-06-05T20:08:21+00:00

I am trying to update a table and I am only given a varchar

  • 0

I am trying to update a table and I am only given a varchar value:

UPDATE table
SET Deadline = CONVERT(DATETIME, '06/18/2012 12:00 AM')
FROM table
WHERE nominal_id = 2650

The error I get is:

Msg 241, Level 16, State 1, Line 10
Conversion failed when converting
date and/or time from character string.

But when I do a simple SELECT CONVERT(DATETIME, '12:00 PM'), it returns the proper value. What do I seem to be missing here? Should I be CASTing the varchar?

  • 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-05T20:08:23+00:00Added an answer on June 5, 2026 at 8:08 pm

    You should always use unambiguous, region-agnostic strings for date/time literals. In your case this should work better (and you won’t need an explicit convert to datetime):

    '20120618 12:00 AM'
    

    I highly recommend you change the input format. If you can’t change the input format, then perhaps:

    CONVERT(DATETIME, CONVERT(VARCHAR(19), '06/18/2012 12:00 AM', 101))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m trying to update time in datetime field as UPDATE table_name SET col_name=to_DATE('04/02/2012 00:12:00','MM/DD/YYYY
I am trying to update table A with data from table B. I thought
I am trying to update a field in a table with data from another
Im trying to update a table with data from another table, the relation between
I'm trying to update one table based on values in another table. What's wrong
I am trying to update a table according to this trigger: CREATE TRIGGER alert
I have been trying to update a table in MySQL 5.0 with Coldfusion MX
Here is my trial query. I am trying to update TABLE1 table with it's
I am trying to update a column in my table which was last inserted.
I am trying to update rows in a data table that intersect rows in

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.