简体   繁体   English

当描述栏文字中有逗号时,无法将SQL结果导出为Excel文件

[英]Can't export SQL results as excel file when commas are in the description column text

I am seeing an issue here. 我在这里看到一个问题。 I have a sql database with over 10,000 records. 我有一个超过10,000条记录的sql数据库。 There is a description column that contains user input from our support website. 有一个描述列,其中包含来自我们支持网站的用户输入。 Some users put commas into their description for grammar purposes. 一些用户出于语法目的在其描述中添加了逗号。 When I go to export my sql results as a excel file, the commas in the user description text mess up the arrangement of the file. 当我将sql结果导出为ex​​cel文件时,用户描述文本中的逗号会弄乱文件的排列方式。 I need to export as what's in the SQL cells and not every time it sees a comma. 我需要导出为SQL单元格中的内容,而不是每次看到逗号时都导出。 Please help? 请帮忙?

I believe if you wrap each output field in quotes, Excel should know to treat that as one field. 我相信,如果将每个输出字段都用引号引起来,则Excel应该知道将其视为一个字段。

I hope this helps. 我希望这有帮助。

Thank you, I also did a replace within the database and replaced all the commas with a space, and then replaced all the tabs and line breaks with a space as well. 谢谢,我还在数据库中进行了替换,并用空格替换了所有逗号,然后也用空格替换了所有制表符和换行符。 The new line delimiter was making excel think it was a new cell. 新的行分隔符使excel认为这是一个新单元格。 I opened the excel file in notepad++ to see all of the LF's and CRLF's and then just searched+replaced the ascii sequence of the two in SQL with a space. 我在notepad ++中打开excel文件以查看所有LF和CRLF,然后在SQL中用空格搜索和替换了两者的ascii序列。 LF's, commas, and tabs, are all non important characters to preserve. LF,逗号和制表符都是不重要的要保留的字符。 Thanks again. 再次感谢。 -Chris -克里斯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM