I have a date field and I need to check if it is 5 characters and if so format it as YYYYYMMDD
Some of the dates are stored as 5 characters(i.e. 70201 (represents 20070201)) or 6 characters(i.e. 150201(represents 20150201)
How can I convert the date so I can check the length of it for 5 characters?
Thanks
Are those the only two formats? And are they stored as strings or numbers? If it's stored as a number then I think you just need to add 2000000000, but the better solution would be to stored them as actual dates in your datawarehouse - you should be able to convert them in your ETL process on the way in.
Have people forgotten the millennium bug already...?