title: Fill Zero values with Previous Non Zero Values in SQL Server
body: <p>I'm trying to fill the zero values of all rows with the previously given dividend data. How do fill the zero values with the previously given dividend and also do that for all given rows in MS SQL server?</p>
  
  <p>How to do this using SELECT COMMAND without using the UPDATE command?</p>
  
  <pre><code>Date      | ticker| dividends|
  2019/01/24| AAPL |          0| 
  2019/01/23| AAPL |          0|        
  2019/01/22| AAPL |          0| 
  2019/01/21| AAPL |       0.77|
  2019/01/20| AAPL |          0|       
  2019/01/19| AAPL |          0|       
  2019/01/18| AAPL |          0|       
  2019/01/17| AAPL |       0.82| 
  ....
  ....
  
  **OUTPUT**
  Date      | ticker| dividends|
  2019/01/24| AAPL |       0.77| 
  2019/01/23| AAPL |       0.77|        
  2019/01/22| AAPL |       0.77| 
  2019/01/21| AAPL |       0.77|
  2019/01/20| AAPL |       0.82|       
  2019/01/19| AAPL |       0.82|       
  2019/01/18| AAPL |       0.82|       
  2019/01/17| AAPL |       0.82| 
  ....
  ....
  </code></pre>