RavenTim
asked on
MS SQL 2005 substring - replace question
I have a field in a table that contains data that I need to manipulate for sorting. And I need to do this just as an output using a select query (I don't want to change it in the table). I need to select 3 fields; tempid, type, location. The "location" field contains the data to be manipulated. Here's a few examples:
SB-01-F3-015 - I need this to OUTPUT as SB-01-3F-015
SB-01-B4-010 - I need this to OUTPUT as SB-01-4B-010
SB-01-D2-008 - I need this to OUTPUT as SB-01-2D-008
I assume you use some kind of replace command... The command will always be transposing the 4th and 5th character of the location field.
SB-01-F3-015 - I need this to OUTPUT as SB-01-3F-015
SB-01-B4-010 - I need this to OUTPUT as SB-01-4B-010
SB-01-D2-008 - I need this to OUTPUT as SB-01-2D-008
I assume you use some kind of replace command... The command will always be transposing the 4th and 5th character of the location field.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
SELECT LEFT(myCol,6)+REVERSE(SUBS