title: Escaping dollar signs from hiveql
body: <p>I'm rather new to Hive so be gentle... I have a large table in Hive, and one of the columns has dollar signs in it's values, for example "123$AB". I want to filter the table using this column:</p>
  
  <pre><code>select * from foo where bar = "123$AB"
  </code></pre>
  
  <p>Seemed simple but when I executed the query, I got a prompt asking for input: "<strong>Please specify parameters for this query: AB ________</strong>"</p>
  
  <p>A bit of research turned up this:
  <a href="https://stackoverflow.com/questions/12464636/how-to-set-variables-in-hive-scripts">How to set variables in HIVE scripts</a></p>
  
  <p>I guess Hive is seeing the dollar sign and thinking I want to input a variable or something. OK, so we need to escape the dollar sign.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>select * from foo where bar = "123\$AB"
  select * from foo where bar = "123\\$AB"
  select * from foo where bar = '123$AB'
  select * from foo where bar = '123\$AB'
  select * from foo where bar = '123\\$AB'
  </code></pre>
  
  <p>but I keep getting the same prompt. It just won't recognize '$' as a character. <strong>How do I escape the '$'?</strong></p>
  
  <p>For now I am doing the following:</p>
  
  <pre><code>select * from foo where substr(bar,1,3) = '123'
  </code></pre>
  
  <p>which works fine for now but I still want to know how to escape special characters. Thanks!</p>
  
  <p>EDIT: Workaround available - see comments!</p>
  
  <p>EDIT 2: To the left of the query editor is a "Settings" tab, and at the bottom of the settings tab is "<strong>OPTIONS</strong>: Enable parameterization". I didn't realize what this was until now. I should have <strong>unchecked</strong> this, which would have solved my problem. However, the problem still exists; if there was a situation where I wanted to use a parameter variable, as well as a character string containing a dollar sign.</p>