I have a table, named ‘dates’.
I have a column named SENTDATE where each field has varying numbers of dates in it, each separated by a semi colon (;). the dates are currently in the format YYYYMMDD For example:
20240529;20240626;20240626;20240626;20240626;20240626
20240530;20240620
20240605
20240523;20240523
I’m attempting to convert each of these dates into the format DD/MM/YYYY and keep them delimited by the semi colon so they look like this:
29/05/2024;26/06/2024;26/06/2024;26/06/2024;26/06/2024
30/05/2024;20/06/2024
Unfortunately, I am using SQL Server 2005, so in order to change the formats I’m needing to use SUBSTRING and then combine the different portions of the dates, interspersed with forward slashes:
SUBSTRING(SENTDATE, 1, 4) + ‘/’ + SUBSTRING(SENTDATE, 5, 2) + ‘/’ + SUBSTRING(SENTDATE, 7, 2) but that’s no issue.
Would you know of a way of being able to process each date between the semi colons? I’m assuming it’ll be some sort of split and then recombination of the string?
I haven’t actually tried anything here. I could use PARSENAME but I have no clue how to do that with varying numbers of delimiters.
Thank you.
1