I have a comma delimited list of values which may be different for each record. I would like to change those values to different values. For example, if the value is 1,2, then I would want the value returned to be 2,55.
I am new to writing SQL functions and not sure of the proper SQL syntax. Below is a rough example of how I think it should work, but it does not.
CREATE FUNCTION getServices
( @Val1 nvarchar(50))
DECLARE @tempServices nvarchar(50);
CASE WHEN CHARINDEX(',1,', ',' + @Val1 + ',') > 0 THEN @tempServices = @tempServices + ',' + 2
CASE WHEN CHARINDEX(',2,', ',' + @Val1 + ',') > 0 THEN @tempServices = @tempServices + ',' + 55
SELECT getServices(services) AS t