title: How to put datetime condition in where clause on nvarchar column in TSQL?
body: <p>In SQL server 2005 database, a table has a nvarchar column that contains either datetime or some string value. e.g. <code>03/11/2011 4:00:07 AM</code> or <code>Completed</code>.</p>
  
  <pre><code> select * from log 
   where status &gt;= 
      case isdate(status) 
      when 1 then convert(datetime, '03/11/2011 12:00:01 AM') 
      else '' 
      end 
  and status &lt;= 
      case isdate(status) 
      when 1 then convert(datetime, '03/11/2011 4:00:00 PM') 
      else '' 
  end
  </code></pre>
  
  <p>I need data where status field has datetime and datetime is between date1 and date2. </p>