怎么打开sql .csv文件?

时间:2014-07-14 10:22:56

标签: sql excel csv

在sql中使用SELECT查询我得到了包含许多行和列的结果。它按行和列很好地显示,没有一个混合起来。

我右键单击左上角并保存为.csv。然后我用Excel打开这个文件,我看到很多字段混合在一起,或者单词,值会转到错误的列。

您知道如何保存结果的正确方法,或者从sql查看此.csv文件的正确方法是什么?

谢谢。

按要求更新:我使用的是Microsoft SQL Server Management Studio。 在保存到csv文件之前,我的结果表中的某些行:(此处包含少量列)

Company Pte Ltd Advanced Materials Technologies Pte Ltd. produces precision metal and ceramic parts. It offers metal hinges, metal packages, intricate cylinders, and valve components; latches and counterweights for hard disk drives; 

或者有两列的行(第一个是公司名称,第二个是公司的特征):

ABC PTE LTD  •Project Management
  •Precision Mould Design and Fabrication
  •Multi Colours/Materials Moulding
  •Over Moulding
  •Extreme Thin Wall Compression Moulding
  •Micro Moulding
 

我尝试点击结果表的左上角选择全部,然后右键单击并选择"复制标题"然后过去擅长。但这里有一些问题: 在SSMS中,我在这些数据中清楚地看到了结果:

XYZ Ltd <p>  <table border="0" cellspacing="0" cellpadding="0" width="780">  <tbody>  <tr>  <td valign="top" width="140">  <table border="0" cellspacing="0" cellpadding="0" width="140" height="628">  <tbody>  <tr>  <td height="628" valign="top" width="140">  <p></p></td></tr></tbody></table></td>  <td valign="top" width="500">  <table border="0" cellspacing="0" cellpadding="0" width="500" align="center" height="619">  <tbody>  <tr>  <td height="619" width="500">  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><b><font color="#333333" face="arial"><span style="FONT-SIZE: 12pt">About Us</span></font></b></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> &nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.shaofook.com/images/02.jpg" width="240" height="180">   <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><br />Shao Fook Engineering </span></font></strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><b>Pte Ltd </b>was established in March 1989 as a partnership offering contract services for industrial steel fabrication, installation of equipment for oil refineries, petrochemical, industrial plants, turnkey construction project works for factory expansion and most recently the pharmaceutical industry.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We undertake project work from laydown to complete installation of Packaged equipment such as Pipe Rack Structures, Equipment Structures, Flare Stack Structure, Fired Heaters, HRSG, Boilers, Incinerators, Bio-treaters, Cooling Tower as well as Modular equipment such as Compressors, Pumps, Reactors, Silos, Towers, Exchanges, Loading Arms and quick turn around plant maintenance &nbsp;projects.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"></span></font>&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We also perform Laser Alignment of Rotating Equipment.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We have clocked more than 5 million man-hours and handled more than 100,000 Ton of Steel Structure and 50,000 Ton of equipment within customer's budget and schedule. We diligently adhere to safety procedure outlined in our established Work Procedure, Method Statement and Job Safety Analysis.</span></font></p></td></tr></tbody></table></td></tr></tbody></table>  <table border="0" cellspacing="0" cellpadding="0" width="780">  <tbody>  <tr>  <td valign="top" width="140">  <table border="0" cellspacing="0" cellpadding="0" width="140" height="628">  <tbody>  <tr>  <td height="628" valign="top" width="140">  <p></p></td></tr></tbody></table></td>  <td valign="top" width="500">  <table border="0" cellspacing="0" cellpadding="0" width="500" align="center" height="619">  <tbody>  <tr>  <td height="619" width="500">  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><b><font color="#333333" face="arial"><span style="FONT-SIZE: 12pt">About Us</span></font></b></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> &nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.shaofook.com/images/02.jpg" width="240" height="180">   <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><br />Shao Fook Engineering </span></font></strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><b>Pte Ltd </b>was established in March 1989 as a partnership offering contract services for industrial steel fabrication, installation of equipment for oil refineries, petrochemical, industrial plants, turnkey construction project works for factory expansion and most recently the pharmaceutical industry.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We undertake project work from laydown to complete installation of Packaged equipment such as Pipe Rack Structures, Equipment Structures, Flare Stack Structure, Fired Heaters, HRSG, Boilers, Incinerators, Bio-treaters, Cooling Tower as well as Modular equipment such as Compressors, Pumps, Reactors, Silos, Towers, Exchanges, Loading Arms and quick turn around plant maintenance &nbsp;projects.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"></span></font>&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We also perform Laser Alignment of Rotating Equipment.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We have clocked more than 5 million man-hours and handled more than 100,000 Ton of Steel Structure and 50,000 Ton of equipment within customer's budget and schedule. We diligently adhere to safety procedure outlined in our established Work Procedure, Method Statement and Job Safety Analysis.</span></font></p></td></tr></tbody></table></td></tr></tbody></table><font color="#333333"><strong><font size="2">Shao Fook Engineering </font></strong><font face="arial"><span style="FONT-SIZE: 9pt"><strong>Pte Ltd </strong>was established in March 1989 as a partnership offering contract services for industrial steel fabrication, installation of equipment for oil refineries, petrochemical, industrial plants, turnkey construction project works for factory expansion and most recently the pharmaceutical industry.</span></font></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We undertake project work from laydown to complete installation of Packaged equipment such as Pipe Rack Structures, Equipment Structures, Flare Stack Structure, Fired Heaters, HRSG, Boilers, Incinerators, Bio-treaters, Cooling Tower as well as Modular equipment such as Compressors, Pumps, Reactors, Silos, Towers, Exchanges, Loading Arms and quick turn around plant maintenance &nbsp;projects.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"></span></font>&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We also perform Laser Alignment of Rotating Equipment.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We have clocked more than 5 million man-hours and handled more than 100,000 Ton of Steel Structure and 50,000 Ton of equipment within customer's budget and schedule. We diligently adhere to safety procedure outlined in our established Work Procedure, Method Statement and Job Safety Analysis.</span></font></p>   - Heavy Lifting & Logistic Services    - Laser Alignment and Leveling of Rotating Equipment    - Industrial Fabrication Work & Plant Maintenance    - Equipment Installation for Factories & Industrial Plants    - Construction Works - Mechanical (Major), Civil, Electrical    - Conveyance & Installation of Material Handling & Production   Machines  - Heavy Lifting & Logistic Services    - Laser Alignment and Leveling of Rotating Equipment    - Industrial Fabrication Work & Plant Maintenance    - Equipment Installation for Factories & Industrial Plants    - Construction Works - Mechanical (Major), Civil, Electrical    - Conveyance & Installation of Material Handling & Production   Machines

但是当我粘贴excel时,我会得到这个:

XYZ Ltd <p>  <table border="0" cellspacing="0" cellpadding="0" width="780">  <tbody>  <tr>  <td valign="top" width="140">  <table border="0" cellspacing="0" cellpadding="0" width="140" height="628">  <tbody>  <tr>  <td height="628" valign="top" width="140">  <p></p></td></tr></tbody></table></td>  <td valign="top" width="500">  <table border="0" cellspacing="0" cellpadding="0" width="500" align="center" height="619">  <tbody>  <tr>  <td height="619" width="500">  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><b><font color="#333333" face="arial"><span style="FONT-SIZE: 12pt">About Us</span></font></b></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> &nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.shaofook.com/images/02.jpg" width="240" height="180">   <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><br />Shao Fook Engineering </span></font></strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><b>Pte Ltd </b>was established in March 1989 as a partnership offering contract services for industrial steel fabrication, installation of equipment for oil refineries, petrochemical, industrial plants, turnkey construction project works for factory expansion and most recently the pharmaceutical industry.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We undertake project work from laydown to complete installation of Packaged equipment such as Pipe Rack Structures, Equipment Structures, Flare Stack Structure, Fired Heaters, HRSG, Boilers, Incinerators, Bio-treaters, Cooling Tower as well as Modular equipment such as Compressors, Pumps, Reactors, Silos, Towers, Exchanges, Loading Arms and quick turn around plant maintenance &nbsp;projects.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"></span></font>&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We also perform Laser Alignment of Rotating Equipment.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We have clocked more than 5 million man-hours and handled more than 100,000 Ton of Steel Structure and 50,000 Ton of equipment within customer's budget and schedule. We diligently adhere to safety procedure outlined in our established Work Procedure, Method Statement and Job Safety Analysis.</span></font></p></td></tr></tbody></table></td></tr></tbody></table>  <table border="0" cellspacing="0" cellpadding="0" width="780">  <tbody>  <tr>  <td valign="top" width="140">  <table border="0" cellspacing="0" cellpadding="0" width="140" height="628">  <tbody>  <tr>  <td height="628" valign="top" width="140">  <p></p></td></tr></tbody></table></td>  <td valign="top" width="500">  <table border="0" cellspacing="0" cellpadding="0" width="500" align="center" height="619">  <tbody>  <tr>  <td height="619" width="500">  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><b><font color="#333333" face="arial"><span style="FONT-SIZE: 12pt">About Us</span></font></b></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> &nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.shaofook.com/images/02.jpg" width="240" height="180">   <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><br />Shao Fook Engineering </span></font></strong><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"><b>Pte Ltd </b>was established in March 1989 as a partnership offering contract services for industrial steel fabrication, installation of equipment for oil refineries, petrochemical, industrial plants, turnkey construction project works for factory expansion and most recently the pharmaceutical industry.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We undertake project work from laydown to complete installation of Packaged equipment such as Pipe Rack Structures, Equipment Structures, Flare Stack Structure, Fired Heaters, HRSG, Boilers, Incinerators, Bio-treaters, Cooling Tower as well as Modular equipment such as Compressors, Pumps, Reactors, Silos, Towers, Exchanges, Loading Arms and quick turn around plant maintenance &nbsp;projects.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"></span></font>&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We also perform Laser Alignment of Rotating Equipment.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We have clocked more than 5 million man-hours and handled more than 100,000 Ton of Steel Structure and 50,000 Ton of equipment within customer's budget and schedule. We diligently adhere to safety procedure outlined in our established Work Procedure, Method Statement and Job Safety Analysis.</span></font></p></td></tr></tbody></table></td></tr></tbody></table><font color="#333333"><strong><font size="2">Shao Fook Engineering </font></strong><font face="arial"><span style="FONT-SIZE: 9pt"><strong>Pte Ltd </strong>was established in March 1989 as a partnership offering contract services for industrial steel fabrication, installation of equipment for oil refineries, petrochemical, industrial plants, turnkey construction project works for factory expansion and most recently the pharmaceutical industry.</span></font></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We undertake project work from laydown to complete installation of Packaged equipment such as Pipe Rack Structures, Equipment Structures, Flare Stack Structure, Fired Heaters, HRSG, Boilers, Incinerators, Bio-treaters, Cooling Tower as well as Modular equipment such as Compressors, Pumps, Reactors, Silos, Towers, Exchanges, Loading Arms and quick turn around plant maintenance &nbsp;projects.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt"></span></font>&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We also perform Laser Alignment of Rotating Equipment.</span></font></p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">&nbsp;</p>  <p style="LINE-HEIGHT: 100%; MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"><font color="#333333" face="arial"><span style="FONT-SIZE: 9pt">We have clocked more than 5 million man-hours and handled more than 100,000 Ton of Steel Structure and 50,000 Ton of equipment within customer's budget and schedule. We diligently adhere to safety procedure outlined in our established Work Procedure, Method Statement and Job Safety Analysis.</span></font></p>   #NAME?  #NAME?

因此有2列无法识别并输入错误的数据:

#NAME?  #NAME?

1 个答案:

答案 0 :(得分:0)

最有可能的是,当您保存CSV文件时,您在字段上没有任何分隔符,或者分隔符不是Excel要求的双引号分隔符(在这种情况下,很可能是单引号)。< / p>

Excel要求任何本身包含逗号的字段必须用双引号括起来,否则它无法分辨文件中每个字段的结尾,结果会出现&#34;混合&#34;加载文件时。

这只是猜测,因为您没有向我们展示您在加载时遇到问题的CSV文件示例。如果您要显示该文件的几行,那么对我们来说可能更为明显。

此外,由于您没有提及您使用哪个SQL产品和前端来创建CSV文件,因此无法建议您如何解决引用问题(如果确实如此)是问题)。