tourcd
IS-IT--Management
- Dec 5, 2005
- 37
Does anyone have any ideas how I might achieve the following in a SQL query?
I have an application that generates a date & time in a fixed format. I want to update a Date/Time field in SQL with the date generated by my application.
Unfortunately the date created is in the wrong format, for example todays date is passed as ‘2008630’. The time is also a problem, it's created in the format HHMMX, where X denotes AM/PM or 'T' for Military time. Delimiters aren't used either so there's no easy way of slicing up the text string.
Does anyone know how I can take a string in the format ‘YYYYMMDD HHMMX’ and transform in to something SQL is happy with before updating a record?
I think this would be relatively straight forward to figure out but the date can also be passed in the 'YYYYMDD', 'YYYYMD', 'YYYYDDM' formats making it more difficult and beyond my SQL knowledge
I'd be grateful for some pointers.
Thanks
I have an application that generates a date & time in a fixed format. I want to update a Date/Time field in SQL with the date generated by my application.
Unfortunately the date created is in the wrong format, for example todays date is passed as ‘2008630’. The time is also a problem, it's created in the format HHMMX, where X denotes AM/PM or 'T' for Military time. Delimiters aren't used either so there's no easy way of slicing up the text string.
Does anyone know how I can take a string in the format ‘YYYYMMDD HHMMX’ and transform in to something SQL is happy with before updating a record?
I think this would be relatively straight forward to figure out but the date can also be passed in the 'YYYYMDD', 'YYYYMD', 'YYYYDDM' formats making it more difficult and beyond my SQL knowledge
I'd be grateful for some pointers.
Thanks