How to split a string after specific character in SQL Server and update this value to specific column

前端 未结 8 1195
死守一世寂寞
死守一世寂寞 2020-12-01 09:59

I have table with data 1/1 to 1/20 in one column. I want the value 1 to 20 i.e value after \'/\'(front slash) is updated into other column in same

8条回答
  •  -上瘾入骨i
    2020-12-01 10:53

    SELECT emp.LoginID, emp.JobTitle, emp.BirthDate, emp.ModifiedDate  , 
          CASE  WHEN emp.JobTitle  NOT LIKE '%Document Control%'  THEN emp.JobTitle
                ELSE SUBSTRING(emp.JobTitle,CHARINDEX('Document Control',emp.JobTitle),LEN('Document Control'))
          END 
          ,emp.gender,emp.MaritalStatus
    FROM   HumanResources.Employee [emp]
    WHERE  JobTitle LIKE '[C-F]%'
    

提交回复
热议问题