简体   繁体   English

SQL Server BCP工具

[英]SQL Server BCP tool

I'm trying to IMPORT data from EXPORTED Dat file from SQL Server in this way: 我正在尝试以这种方式从SQL Server的EXPORTED Dat文件中导入数据:

bcp "SELECT FieldName FROM [BaseName].[dbo].[TableName] where xxxxxx=16" 
    queryout Message_out.dat -n -Uusername -Sservername

When I try to import dat to sql server like this 当我尝试像这样将dat导入sql server时

bcp basename.dbo.tablename in "path\to\datfile.dat" -c -T 

I get error: 我得到错误:

Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in BCP data-file 错误= [Microsoft] [SQL Server Native Client 10.0] BCP数据文件中遇到意外的EOF

regards, Grigor. 问候,格里高。

Try to explicitly indicate the field and row terminators for your file, for example, if your file is comma delimited and each row is in a new line: 尝试明确指出文件的字段终止符和行终止符,例如,如果文件用逗号分隔,并且每一行都在换行符中:

bcp basename.dbo.tablename in "path\to\datfile.dat" -c -T -r\n -t,

And if if there are any other peculiarities in the format of your file, use the options to help bcp understand your file format using the options. 并且,如果文件格式中还有其他特性,请使用这些选项来帮助bcp使用这些选项来了解文件格式。 A detailed documentation is available at msdn . 详细的文档可从msdn获得

I see this question is old, but maybe it will help someone in the future... 我认为这个问题很旧,但也许将来会对某人有所帮助...

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

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