简体   繁体   English

SQL Server 2005导入和导出向导

[英]SQL Server 2005 Import and Export Wizard

With reference to Import and Export Wizard, in SQL Server 2005 environment, I would like to receive some suggestions on how to select the best field separator: the table I need to export as flat file for example contains columns with commas inside them, so I can't use comma as field separator. 参考导入和导出向导,在SQL Server 2005环境中,我想收到一些关于如何选择最佳字段分隔符的建议:我需要导出为平面文件的表例如包含其中包含逗号的列,所以我不能使用逗号作为字段分隔符。

I have thought to search in all tables what is the ASCII character (0-255) NOT PRESENT, and use this character as separator, but this search operation is computationally heavy. 我曾想过在所有表中搜索什么是ASCII字符(0-255)NOT PRESENT,并使用此字符作为分隔符,但此搜索操作在计算上很重。

  • What type of character could I use for exporting a table as flat file? 我可以使用什么类型的字符将表导出为平面文件?
  • Could I use a couple of characters, for example ,$ ? 我可以使用几个字符,例如,$
  • Is it preferable to use fixed length fields? 是否最好使用固定长度的字段?

Any suggestion would be appreciated. 任何建议将不胜感激。

The best suggestion will be accepted. 最好的建议将被接受。

Standard practice is to use a delimiter (usually comma ,) and a text qualifier (usually double quote ") 标准做法是使用分隔符(通常是逗号)和文本限定符(通常是双引号“)

The output is then: 输出是:

"Field A","Field B","Field With, A Comma" “场A”,“场B”,“场带,逗号”

Using a text qualifier means you do not need to worry about the delimiter appearing in your fields. 使用文本限定符意味着您无需担心字段中出现的分隔符。 And I wouldn't bother using fixed widths, that could lead to truncation later on if you change the design of the table and forget to update all of your export scripts. 我不打算使用固定宽度,如果您更改表的设计并忘记更新所有导出脚本,可能会导致稍后截断。

Use the csv extension (file.csv) so that other programs recognise the file type. 使用csv扩展名(file.csv),以便其他程序识别文件类型。 CSV stands for Comma Seperated Values. CSV代表逗号分隔值。

I suggest you use TABS , the "|" 我建议你使用TABS,“|” character, or ";" 字符,或“;”

these are commonly used 这些是常用的

Cheers! 干杯!

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

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