Shashank
Shashank

Reputation: 107

Import from MSSQL to Excel when the data contains embedded line breaks

I am trying to export a sql query (MS SQL 2014) into excel 2010. The problem is column values contain line breaks, so the remaining data gets copied to the next line in excel. Is there a way to get rid of this? Keeping the column as is? or maybe encapsulating the column so the sql considers it as one column and ignores the line breaks?

Here is my SQL Query:

select * from tbl_case 
where (casenature not like '%<strong>%' 
and casenature not like '%<br />%' 
and casenature like '%from:%') 
and userid in (select employeelogin from tbl_employees where riding='15010')

Upvotes: 0

Views: 412

Answers (2)

ivan_pozdeev
ivan_pozdeev

Reputation: 36036

Works fine if I use the normal way to import data from MSSQL to Excel which is: in Excel, Data->From other sources->SQL server.

To import data resulting from an arbitrary SQL query:

  • At the last step of the wizard (where you select the range), press Properties...
  • In the resulting Connection properties window:
    • Definition->Command type - SQL
    • In the Command text field, write your query

Upvotes: 1

tungula
tungula

Reputation: 578

You can replace enter keys with space in select statement, and then export to Excel

Upvotes: 0

Related Questions