0

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 1

3

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, '-', '')
Sign up to request clarification or add additional context in comments.

1 Comment

Can you explain "didn't work"? The code posted would remove all occurrences of a hyphen (dashes) in the column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.