title: Date and Time Format Conversion in SQL Server 2012
body: <p>I am using SQL Server 2012 sp1 .I have a table column with the following Date Time values.</p>
  
  <pre><code>BLDCHKDT
  -----------------------
  2013-06-19 00:00:00.000
  2013-07-22 00:00:00.000
  2013-08-21 00:00:00.000
  2013-09-20 00:00:00.000
  2013-11-18 00:00:00.000
  </code></pre>
  
  <p>I would like to retrieve the date and Time in the following formats:</p>
  
  <pre><code>Date: 19062013
  Time: 00000000
  </code></pre>
  
  <p>Is it possible? I have reviewed the SQL Server help documentation for the FORMAT, CAST and CONVERT functions and I can’t seem to get any headway.
  So far I have attempted the following conversions:</p>
  
  <p><em>N.B Please note that I am converting to Date time to string to facilitate a flat file export.</em></p>
  
  <p>--Retrieving Date</p>
  
  <pre><code>SELECT [DATE-BLDCHKD] = CONVERT (VARCHAR (20), BLDCHKDT, 112)
  FROM TABLEA
  
  DATE-BLDCHKD
  --------------------
  20130619
  20130722
  20130821
  20130920
  20131118
  
  --Retrieving Time
  SELECT [TIME-BLDCHKD] = CONVERT (VARCHAR (20), BLDCHKDT, 24)
  FROM TABLEA
  
  TIME-BLDCHKD
  --------------------
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  </code></pre>
  
  <p>I appreciate your insights. Thank you in advance.</p>