当数据包含embedded的换行符时,从MSSQL导入到Excel
我试图导出一个SQL查询(MS SQL 2014)到Excel 2010年。问题是列值包含换行符,所以剩余的数据被复制到Excel中的下一行。 有没有办法摆脱这个? 保持列是? 或者可能封装列,以便sql认为它是一列,并忽略换行符?
这是我的SQL查询:
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')
正常工作,如果我使用正常的方式从MSSQL导入数据到Excel是:在Excel中,数据Data->From other sources->SQL server
。
要导入从任意SQL查询得到的数据:
- 在向导的最后一步(select范围)中,按
Properties...
- 在生成的
Connection properties
窗口中:-
Definition->Command type
–SQL
- 在
Command text
字段中,编写您的查询
-
您可以在select语句中用空格replaceinput键,然后导出到Excel