title: Error while converting nvarchar to datetime
body: <p>I would like to execute my MSSQL stored procedure from my java program by giving as parameters two dates to have aselection between this two dates. So in java code I proceeded like this:</p>
  
  <pre><code>"EXEC [dbo].[MyProcedure] " + "'"+ dateFrom+"'" ,"'"+dateTo"'"
  </code></pre>
  
  <p>I have declared my parameters in sql server procedure like this way : <code>@collected_date1 datetime, @collected_date2 datetime</code>.
  And I selected the two date like this :</p>
  
  <pre><code>SELECT @date1 = Convert(varchar(23),@collected_date1,121)
  SELECT @date2= Convert(varchar(23),@collected_date2, 121)  
  </code></pre>
  
  <p>However I have this message error : <code>Error converting data type nvarchar to datetime</code></p>
  
  <p>Could you help me please ?
  Thank you</p>