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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:48:06+00:00 2026-06-15T21:48:06+00:00

I have about 2 million rows in my table with a column for dates…

  • 0

I have about 2 million rows in my table with a column for dates… this column is of type VARCHAR, and it contains a wrong date format, we have this format dd/mm/YYYY and it must be YYYY-mm-dd…

How can I change it? Remember it is a Varchar column, not a Datetime column (and it can’t be datetime field because we manipulate it with our queries)

Thank you in advice.

UPDATE

As I said, I have MILLIONS of rows, so it’s not possible to query one by one the date field to a new one, as you said in your responses…. I need some kind of “automatic” mode to transfer every row to it’s new format and datatype column.

  • 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-15T21:48:08+00:00Added an answer on June 15, 2026 at 9:48 pm

    If your end goal is just cleanup to end up in a datetime column, you only need to add a new column, then transfer the data:

    update tbl
       set new_datetime_col = convert(datetime, dateinvarchar, 103);
    

    Query:

    update tbl
       set dateinvarchar = convert(char(10),
                           convert(datetime,
                                   dateinvarchar, 103), 121)
    select * from tbl
    

    Sample table:

    create table tbl (dateinvarchar varchar(10));
    insert tbl values
      ('01/02/2012'),
      ('02/02/2012'),
      ('03/02/2012'),
      ('14/12/2012');
    

    Sample Result:

    | DATEINVARCHAR |
    -----------------
    |    2012-02-01 |
    |    2012-02-02 |
    |    2012-02-03 |
    |    2012-12-14 |
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with about 35 million rows. each has about 35 integer
i have a table on SQL Server with about 1 million rows. It has
I have about 1 million rows on users table and have columns A AA
I have a Postgres table with about 4.5 million rows. The columns are basically
I have a table about 10 million rows. We just imported it from another
Say I have a large table, about 2 million rows and 50 columns. Using
I have a large MySQL table (about 750 million rows) and I just want
I have a pretty big table with contains about 3 million records. When running
The Problem I have a table that's about 2 million rows (at 115 MB)
I have a MySQL MyISAM table with about 400 million rows of price data

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.