I have a column with both chars and numbers that are separated by an Underscore
Ex: PI (column Name) = ID_32,ID_43,ID_03
I also created a new column called UniqueColumn. In this column I just want the numbers that are in the PI column
therefore it should look like this: UniqueColumn=32,43,03
My code thus far:
UPDATE table
SET UniqueColumn = RIGHT(PI,LEN(PI)-CHARINDEX('_',PI));
select top 10 dbo.table.UniqueColumn from dbo.table;
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire