title: Unable to replace an empty string in SQL Server 2017
body: <p>I have a table with a varchar(100) column that has some empty values.
  When I try to replace the empty strings with a value, nothing happens. I cannot figure out why.
  I am sure the value in the cells is not null.
  I can reproduce with a temporary table and some sample data.</p>
  <p>The below SQL should return a result set in which the [ReplacedTextCol] always has a value, but even when using replace, I cannot replace the empty string:</p>
  <pre><code>create table #tempt
  (
      col1 varchar(100)
  )
  
  insert into #tempt(col1) 
  values('')
  ,('')
  ,('some value')
  
  select replace(col1, '','replaced') as ReplacedTextCol,* 
  from #tempt
  </code></pre>
  <p>The result of the above query is shown below:</p>
  <p><a href="https://i.stack.imgur.com/iB43O.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iB43O.jpg" alt="enter image description here" /></a></p>
  <p>Table, DB &amp; server uses the collation SQL_Latin1_General_CP1_CI_AS</p>
  <p>Appreciate any pointer as to where I'm going wrong.</p>