title: SQL Server 2008: generic convert to date
body: <p>I have a little problem in my query. My database at my local development server is running with French date format (<code>dd/mm/yyyy</code>) but my release server is on North American format (<code>mm/dd/yyyy</code>).</p>
  
  <p>So this throws an error</p>
  
  <pre><code>SELECT CodPeriodoInsc, 
         CONVERT(VARCHAR, FechaDesde, 103) AS FechaDesde, 
         CONVERT(VARCHAR, FechaHasta, 103) AS FechaHasta 
  FROM SedesPeriodosInscripcion
  WHERE FechaDesde &lt;= '25/06/2012'
  </code></pre>
  
  <p>But it works on development, and this works on release</p>
  
  <pre><code>SELECT CodPeriodoInsc,
         CONVERT(VARCHAR, FechaDesde, 103) AS FechaDesde, 
         CONVERT(VARCHAR, FechaHasta, 103) AS FechaHasta 
  FROM SedesPeriodosInscripcion
  WHERE FechaDesde &lt;= '06/25/2012'
  </code></pre>
  
  <p>But it doesn't work on development.</p>
  
  <p>Is there a way I can make the query work on both databases?</p>