Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Error: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
    text
    copied!<p>The data going in: </p> <pre><code>&lt;F1&gt;000001234&lt;/F1&gt; &lt;F2&gt;133228579&lt;/F2&gt; &lt;F3&gt;2011-05-25&lt;/F3&gt; &lt;F4&gt;21-332211&lt;/F4&gt; &lt;F5&gt;TxtMail&lt;/F5&gt; &lt;F6/&gt; &lt;F7&gt;26/04/2011&lt;/F7&gt; &lt;F8&gt;00:09:13&lt;/F8&gt; &lt;F9&gt;0:00&lt;/F9&gt; &lt;F10/&gt; &lt;F11/&gt; &lt;F12&gt;Text Service&lt;/F12&gt; &lt;F13&gt;0294443333&lt;/F13&gt; &lt;F14&gt;TXT&lt;/F14&gt; &lt;F15&gt;FR&lt;/F15&gt; &lt;F16&gt;0.17&lt;/F16&gt; </code></pre> <p>Relevant parts of the stored procedure :</p> <pre><code>@F1 VARCHAR(24) = NULL, --AccountNumber @F2 VARCHAR(24) = NULL, --InvoiceNumber @F3 VARCHAR(24) = NULL, --InvoiceDate @F4 VARCHAR(24) = NULL, --CallerNumber @F5 VARCHAR(10) = NULL, --Service @F6 VARCHAR(10) = NULL, -- @F7 varchar(24) = NULL, --CallDate @F8 VARCHAR(24) = NULL, --CallTime @F9 VARCHAR(50) = NULL, --Duration @F10 VARCHAR(50) = NULL, -- @F11 VARCHAR(10) = NULL, -- @F12 VARCHAR(24) = NULL, --Network @F13 VARCHAR(24) = NULL, --CallingNumber @F14 VARCHAR(10) = NULL, --Type @F15 VARCHAR(10) = NULL, --TypeName @F16 MONEY = NULL, --Amount DECLARE @Date VARCHAR(20) SET @Date = RIGHT(@F7,4)+'/'+SUBSTRING(@F7,4,2)+'/'+LEFT(@F7,2) -- Combine the date and time into a datetime data type -- For Time DECLARE @time DATETIME SET @time = CONVERT(DATETIME, @Date + ' ' + @F8) </code></pre> <p>The error: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.</p> <p>This is the only invocation of CONVERT(DATETIME) and I don't use CAST</p> <p>If I just pass in the data directly, the row gets inserted. If I run the sproc, it goes out-of-range.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload