title: convert varchar parameter to datetime in sql procedure
body: <p>Below is my procedure</p>
  
  <pre><code>create proc abc -- 'all','18','18','12/12/2015','','','inactive'   
  @JoinedDate varchar(100),        
  @LastLogin varchar(100),        
  @Location varchar(100),        
  @Status varchar(50) 
  
  as        
  declare @WhereCondition varchar(1000)   
  
  set @WhereCondition=' '        
  if @LastLogin !=''        
  set @WhereCondition= ' and u.UpdatedDate&gt;=' + CAST(@LastLogin as datetime) 
  
  exec('select * from tableName where' + @WhereCondition)
  </code></pre>
  
  <p>When I am passing the parameter LastLogin it is giving me error as below:</p>
  
  <p><strong>Conversion failed when converting date and/or time from character string.</strong></p>