I have a SQL Table with the column date, with each entry being a string in the format YYYY-DD-MM (I know it should be a Date data type, but I'm just accessing the data). I would like each entry in the column to be a string in the format YYYYDDMM (without the dashes). Basically stripping the dashes from the string.
1 Answer
The absolute best thing would be to fix the tables and change the datatype to the proper one.
But to answer your question is really just a basic replace.
update YourTable
Set YourFauxDateColumn = replace(YourFauxDateColumn, '-', '')
1 Comment
Sean Lange
Can you explain "didn't work"? The code posted would remove all occurrences of a hyphen (dashes) in the column.