【发布时间】:2014-07-14 10:22:55
【问题描述】:
在 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
我尝试单击结果表的左上角以全选,然后右键单击并选择“带有标题的复制”然后过去到excel。但这里有一些问题: 在 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"> </p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> <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"> </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 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> </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"> </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"> </p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> <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"> </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 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> </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"> </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"> </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 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> </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"> </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"> </p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> <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"> </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 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> </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"> </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"> </p><img src="http://www.shaofook.com/images/01.jpg" width="240" height="180"> <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"> </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 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> </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"> </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"> </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 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> </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"> </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?
【问题讨论】:
-
您的意思是,您想读取或导入 csv 文件?
-
我的意思是我怎么能读取(不导入).csv 文件?是否有任何阅读器(如 excel?)可以以我在 sql server 中看到的相同表格格式阅读它?
-
所以基本上你想使用哪种语言 .net 、php 或什么来读取 .csv 格式的 sql 表?
-
这个链接一定能帮到你blog.sqlauthority.com/2008/02/06/…
-
我不需要使用任何语言来阅读它,任何可以查看该文件的编辑器都可以(就像我们使用记事本、写字板、word ... 来阅读文本文件)。您发布的链接是另一种方式,将 .csv 导入 sql server。但是我从 sql server 导出到 .csv 并将这个文件传递给其他人,他不使用 sql server 但他想使用更简单的程序来查看这个文件并在桌子上做一些事情。