title: Microsoft SQL Server 2005 cast date/time to string
body: <p>How can I convert @lastEndTime to a string formated <code>YYYY-MM-DD HH:MM:SS.MS</code>?</p>
  
  <pre><code>DECLARE @lastEndTime datetime
  </code></pre>