Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to test for valid date

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
I have a table that was imported from a csv file. Some of the records were not properly formatted. I have a varchar col called dba_use that has my text that will become my last_modified_date col data. Last_modified_date is a date col and I want to update it and convert the string data to dates in the process. But, when I hit a bad record that cant be converted by the str_to_date function, my update just fails. How can I test for invalid dates so i can skip them and get my update to work for the records with valid dates?

update 2008_2009 set last_modified_date = str_to_date(dba_use,'%m/%d/%Y %l:%i:%s %p') fails when it hits a dba_use column value that is not a possible date, but text like 'Windows 2000' etc.

thanks for any suggestions

 
thanks, i was hoping for a built in function but that looks like it will work..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top