Reputation:
im trying to get a date from a name i have got the date but i need it to be in yyyy-mm-dd format.
what i get: 20221201
what i need: 2022-12-01
please help me on this
Upvotes: 0
Views: 46
Reputation: 9
This should work ,
SELECT CONVERT(DATE,RIGHT('ABCDEF20221201',8),103)
Upvotes: 0
Reputation: 81970
Could be as simple as this ... assuming the date string is the last 8 characters
Example
Select try_convert(date,right('typographical_dismal_subjoinByapostrophize1_12345_20221201',8))
Resutls
2022-12-01
Upvotes: 1