Need to create new column from the existing column with string manipulation on the fly
Existing stored string in the column is nvarchar
Existing column string example value 0001134564444
Need, the first three positions '000' to become 'AB' (there is a good number of variations)
the following 11 shall be 1 (there are eight variations results (1 to 8))
the following 3456 shall take the last two characters 56
the last 4444 shall not change.
The new string should then be AB5614444
Now need this done in SQL server,...
have tried with, substring, stuff, replace, charindex
Have reached the point...never too late to give up, this is my last chance.
Oracle version,
select column NewColumn, decode(substr(column, 1,3),'000','AB', '010', 'BC' ...)||substr(column,8,2)
||substr(column,5,1)||substr(column,10,5) NewStringColumn from table
getting absolutely nowhere with SQL server for this task, oracle remains no longer an option. any help is appreciated,