Hello,
I need to change the following data 'SHELF 123' to look like 'IC-SHELF-00123'
The command I used to conver 'ROW 123' into 'IC-ROW-123' was as follows:
UPDATE <TableName>
SET <FieldName> =
(Select 'IC'+'-'+ RTRIM(Left(<FieldName>,Convert(varchar,PATINDEX ( '% %' , <FieldName>))))+'-'+LTRIM(Right(<FieldName>, Convert(varchar,PATINDEX ( '% %' , <FieldName>)))))
BUT, when I use this same one on SHELF it doesn't work. Then I realized that the number part has to be 5 digits and now I am totally lost.
I need to change the following data 'SHELF 123' to look like 'IC-SHELF-00123'
The command I used to conver 'ROW 123' into 'IC-ROW-123' was as follows:
UPDATE <TableName>
SET <FieldName> =
(Select 'IC'+'-'+ RTRIM(Left(<FieldName>,Convert(varchar,PATINDEX ( '% %' , <FieldName>))))+'-'+LTRIM(Right(<FieldName>, Convert(varchar,PATINDEX ( '% %' , <FieldName>)))))
BUT, when I use this same one on SHELF it doesn't work. Then I realized that the number part has to be 5 digits and now I am totally lost.