'How to replace underscore to space by using t-sql?

SELECT [Name]
      ,[Code]
      ,case when len([ParentCode]) = '' then [Code] else [ParentCode] end as [ParentCode]
      ,case when len([Descr])=0 then [Code] else [Descr] end as [Descr]
      ,[Cumulative]
      ,[Expense]
      ,[Accts]
      ,[Admin]
      ,[Assessment]
      ,[Balance]
      ,[Fiber]
      ,[GL]
      ,[LV]
      ,[Slush]
  FROM [KR].[pl].[Accounts]

Currently I have that query, but I want to change the part where data contains underscore instead space in ParentCode, and Code columns. Ex (slush_Code) how can i modify this query to work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source