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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:52:31+00:00 2026-06-08T07:52:31+00:00

I have an older table where a datetime column was built as a varchar

  • 0

I have an older table where a datetime column was built as a varchar and the form inserting data into this table was freeform with no validation/restrictions. I have corrected the form and now am set upon the task of normalizing the data. I need to query this column for all records that cannot be CAST as a datetime

Examples:

9/30/2008
9/30/13
august 2010
5/11
30SEP12
31-Mar-2011
2005

I have already cleaned up the N/A data to be NULL but am unsure of an efficient way of getting everything that would not be considered a valid date. Any hints or tricks or am I going to have to go through record by record to convert this column to a datetime data type?

  • 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-08T07:52:32+00:00Added an answer on June 8, 2026 at 7:52 am

    You can use ISDATE to determine records that aren’t dates:

    SELECT *
    FROM YourTable
    WHERE isdate(OldDateField) = 0
    

    You can use the query below to see which ones won’t be dates:

    SELECT isdate('9/30/2008')
    SELECT isdate('9/30/13')
    SELECT isdate('august 2010')
    SELECT isdate('5/11')
    SELECT isdate('30SEP12')
    SELECT isdate('31-Mar-2011 2005')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server 2008 table with a DateTime column that I'd like
I have a table with a column dedicated solely to DATETIME values (e.g. 2010-11-12
I have this table: id track_name datetime weight 1 aName 2010-06-01 09:00:00 1 2
I have an order table, and it has a datetime column called order_date. I
I have a mysql table with a datetime column. I want to fetch rows
I have a table, let's call it My_Table that has a Created datetime column
I have a table with an auto-increment primary key column and a datetime column.
I have a column in a table in which we are storing date in
I have a table that looks like something like this: timestamp value person ===============================================
I have a DATETIME column EntryDate and I am storing values as dd/MM/yyyy format.

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.