title: Copy- paste data from SQL to EXCEL
body: <p>A very straightforward procedure is too difficult for me now. I wrote a query then copied the data with headers when I pasted into excel it looked messy but now I know what's happening. The address column in my application is a multi-line text box - in sql the column type: varchar(Max). However in the Sql that column is a single line value.. So what happened is that in Excel. It broke the Address field into the way its entered in the application .. 
  Any idea how to fix this. </p>
  
  <p>I tried Replace and found the ASCHI character but again it didn't work.</p>
  
  <pre><code>replace(replace(replace([GP], CHAR(13), ''), CHAR(32), ' '), CHAR(10), ', ')
  </code></pre>
  
  <p>Example:</p>
  
  <p>Database Table:
  ID; PK int Identity
  Name: varchar(5)
  Address1: varchar(Max) - MultiLine textbox in application
  Address2: Varchar(MAX)- MultiLine textbox in application
  Comment: Varchar(MAX)- MultiLine textbox in application</p>
  
  <p>Table in Sql Management Studio</p>
  
  <pre><code> ID Name    Address1             Address2                        Comment
  1   Dave    13 Close Drive, Newcastle, United Kingdom, NW12 8GS 12 Driveway, Newcastle, NW12 8HS    This comment is shown in SQL SERVER Management in one long line ( not in New Line)
  </code></pre>
  
  <p>Once its copied to Excel:</p>
  
  <pre><code>ID   Name Address1           Address2      Comment
  1   Dave   13 Close Drive      12 Driveway, This comment is shown in SQL 
  
  Newcastle, 
  United Kingdom,
  NW12 8GS
  Newcastle, 
  NW12 8HS
  SERVER Management in one long line ( not in New Line)
  </code></pre>