title: SQL - Get numbers from string after a pound (#) sign
body: <p>I am attempting to get numbers from a string in SQL Server 2012 that are located after a pound (#) sign and before any spaces that follow.  For instance, store numbers.  Let's say we have the following:</p>
  
  <pre><code>Big Box Store #450
  Big Box Store #768
  Little Shop #2
  Widgets Warehouse #678
  Little Shop #5
  Widgets Warehouse #559
  Corner Boutiques #32 *CLOSED
  Corner Boutiques #67 *CLOSED
  Corner Boutiques #12
  Buy More #1047 SUPERSTORE
  1 Stop Shop #3
  1 Stop Shop #17
  You 2 Me #16
  </code></pre>
  
  <p>I would return the following: 450, 768, 2, 678, 5, 559, 32, 67, 12, 1047, 3, 17, 16.</p>
  
  <p>As you can see, not all of the strings have numbers at the very end.  Some of them even have a numerical character in the name of the store.  I figure the best way of going about this is just to extract the numbers following the pound sign.</p>
  
  <p>Is there a way to do this?  I've looked at the following articles:</p>
  
  <p><a href="https://stackoverflow.com/questions/16667251/query-to-get-only-numbers-from-a-string">Query to get only numbers from a string</a></p>
  
  <p><a href="https://www.sqlservercentral.com/Forums/Topic456023-338-1.aspx" rel="nofollow noreferrer">https://www.sqlservercentral.com/Forums/Topic456023-338-1.aspx</a></p>
  
  <p>It seems like <code>PATINDEX</code> may be good to use, but I am unsure as what I've tried thus far doesn't return expected results.</p>
  
  <p>Many thanks!</p>