title: PostgreSQL - batch + script + variable
body: <p>I am not a programmer, I am struggling a bit with this.</p>
  
  <p>I have a batch file connecting to my PostgreSQL server, and then open a sql script. Everything works as expected. My question is how to pass a variable (if possible) from one to the other.</p>
  
  <p>Here is my batch file:</p>
  
  <pre><code>set PGPASSWORD=xxxx
  cls
  @echo off
  C:\Progra~1\PostgreSQL\8.3\bin\psql -d Total -h localhost -p 5432 -U postgres -f C:\TotalProteinImport.sql
  </code></pre>
  
  <p>And here's the script:</p>
  
  <pre><code>copy totalprotein from 'c:/TP.csv' DELIMITERS ',' CSV HEADER;
  
  update anagrafica
  set pt=(select totalprotein.resultvalue from totalprotein where totalprotein.accessionnbr=anagrafica.id)
  where data_analisi = '12/23/2011';
  
  delete from totalprotein;
  </code></pre>
  
  <p>This is working great, now the question is how could I pass a variable that would carry the date for <code>data_analisi</code>?
  Like in the batch file, "Please enter date", and then the value is passed to the sql script.</p>