One of the databases I just inherited has a field where is shows a warranty expiration date. However, the data is in different formats: 10/31/2007 6/30/2007 2008-07-30 And of course, the field where the date is stored is a VarChar. Are there any SQL functions that would be able to pull the different formats in a query? I've looked at several, but it looks like they need a consistent format. Thanks James
Actually, I am using MSSQL, and the CAST function worked fine until I hit data that had characters in it and not any kind of date reference. There are alot of SPs in the dB and I went ahead and created a utility to change all the different date formats into one comon format. As I started digging into other dBs here, I have come across more date formats that are not consistent and will be cleaning those as well. What was the original programmer thinking when he created programs that wrote different date formats is beyond me! Thanks for the CAST info.
My guess is that the input was a textbox where the user got to dictate the format. Always a bad move.
Actually, the programmer changed the date format in the code. The user had no control on how the date was inserted. His crappy coding actually is why I was hired! He left over a year ago, and the employees having been frustrated with the program (and it is used by almost all of the employees). Keeps me employed