Reputation: 150
Using T-SQL, I'm trying to find the easiest way to make:
"abc.def.ghi/jkl" become "abc/def/ghi.jkl"?
Basically switch the . and /
Thank you
Upvotes: 4
Views: 509
Reputation:
SELECT REVERSE(@myvar) AS Reversed,
RIGHT(@myVar, CHARINDEX(‘ ‘, REVERSE(@myvar))) as Lastname;
took the answer from this guys blog. The first google result. You will need to modify it for your needs
Upvotes: 0
Reputation: 134971
One way
select replace(replace(replace('abc.def.ghi/jkl','/','-'),'.','/'),'-','.')
you need to use an intermediate step, I chose the - symbol, choose something which won't exist in your string
Upvotes: 10