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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:30:24+00:00 2026-05-26T15:30:24+00:00

I have a varchar column which contains date in following format dd/mm/yyyy I need

  • 0

I have a varchar column which contains date in following format

dd/mm/yyyy

I need to convert the column’s datatype to DATE. I’m using the following query

alter table [tblDocumentRevision]
alter column [RevisionDate] date  null

but I get an error

Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.
The statement has been terminated.

I’m sure that all the values are in dd/mm/yyyy format. So why is it giving me the error?

Then I added a new column and tried

UPDATE [tblDocumentRevision]
SET NewDate = convert(date,[RevisionDate],103)
WHERE ISDATE([RevisionDate]) = 1

The check for ISDATE() = 1 should filter out those entries that cannot be converted to a DATE.

Then NewDate column has only the values where month and date are both less than or equal to 12 others are null. So I’m clearly seeing a issue with the dd/mm/yyyy format

Can someone please help me to solve this issue?

  • 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-26T15:30:25+00:00Added an answer on May 26, 2026 at 3:30 pm

    I used Google to find this. Try setting the format being running ALTER COLUMN.

    EDIT

    CREATE TABLE #tmpTest
    (
      MyCol VARCHAR(20)
    );
    
    INSERT INTO #tmpTest(MyCol)
      VALUES('31/12/99');
    
    ALTER TABLE #tmpTest ALTER COLUMN MyCol DATE;
    

    Yields:

    Msg 241, Level 16, State 1, Line 9
    Conversion failed when converting date and/or time from character string.
    The statement has been terminated.

    Whereas:

    CREATE TABLE #tmpTest
    (
      MyCol VARCHAR(20)
    );
    
    INSERT INTO #tmpTest(MyCol)
      VALUES('31/12/99');
    
    SET DATEFORMAT DMY;
    
    ALTER TABLE #tmpTest ALTER COLUMN MyCol DATE;
    

    Yields:

    (1 row(s) affected)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MySQL and I currently have a VARCHAR column which stores times (in
Let's say I have the following tables: PartyRelationship EffectiveDatedAttributes PartyRelationship contains a varchar column
I have column with varchar values like 022008 that I need to convert into
I have some data which is stored in a VARCHAR(MAX) column that contains the
I have a varchar(5) column in a table which contains the hour and minutes
I have a column which contains a mixture of letters and numbers. I need
I have a table which has a column 'Faktor' (varchar(50)) which contains expressions like:
I have a database column which contains varchar data type. I would like to
I have a varchar(100) column in a table that contains a mix of integers
I have a ReferenceID varchar(6) column in over 80 different tables. I need to

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.