title: SQL declare datetime - 1001-01-01
body: <p>I am trying to declare a datetime variable with the value <strong><em>1001-01-01 00:00:00.000</em></strong></p>
  
  <p>I have tried the following approaches with no luck</p>
  
  <pre><code>declare @d1 datetime = '1001-01-01';
  declare @d2 datetime = 10010101;
  declare @d3 datetime = '1001-01-01 00:00:00';
  declare @d4 datetime = cast ('1001-01-01' as datetime)
  </code></pre>
  
  <p>I get the following errors</p>
  
  <pre><code>Msg 242, Level 16, State 3, Line 1
  The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
  Msg 8115, Level 16, State 2, Line 2
  Arithmetic overflow error converting expression to data type datetime.
  Msg 242, Level 16, State 3, Line 3
  The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
  Msg 242, Level 16, State 3, Line 4
  The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
  </code></pre>
  
  <p>Is it possible to declare a <code>datetime</code> variable which can hold the value <strong><em>1001-01-01 00:00:00.000</em></strong>?</p>