dastaub
asked on
SQL 2005 T-SQL
I would like to use T-sql to flip a string.
I would like to flip 'green,blue' to 'blue,green'
i wish to flip the order of two words that are separated by a comma.
I would like to flip 'green,blue' to 'blue,green'
i wish to flip the order of two words that are separated by a comma.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
declare @TotalBy as varchar(max)
set @TotalBy = '1FacNNNNNNNNo1,1PDDDDDDoc
set @TotalBy = right(@TotalBy,( len(@TotalBy) - CHARINDEX ( ',' ,@TotalBy)) ) + ',' + left(@TotalBy,CHARINDEX ( ',' ,@TotalBy)-1)
select @TotalBy