title: how to get current date time in sql server?
body: <p>I want to pass sys date to my procedure.
  Below is my code  snippet</p>
  
  <pre><code> DateFormat dateFormat = new SimpleDateFormat("mm/dd/yyyy");
                                             Date date = new Date();
  String insertquery="{ call sp_process_job (?,?,?) }";
  
                      cs = con.prepareCall(insertquery.toString());
                      cs.setString(1,id);
                      cs.setString(2,host);
                      cs.setDate(19,(java.sql.Date) date);
                                            cs.execute();
                            con.commit();
  </code></pre>
  
  <p>My stored Procedure</p>
  
  <pre><code>create procedure sp_process_job (@request_id varchar(25),@host varchar(20),@created_on varchar(25)) as
  
  begin
  
  set dateformat mdy
  SELECT CAST(@created_on as datetime)
  insert into t_job_details(request_id,host,created_on,run_date) 
                  values(@request_id,@host,@created_on)
  
  end
  </code></pre>
  
  <p>getting this error </p>
  
  <blockquote>
    <p>java.util.Date cannot be cast to java.sql.Date.</p>
  </blockquote>