BULK INSERT 格式附近的语法不正确? [英] Incorrect syntax near format in BULK INSERT?

查看:27
本文介绍了BULK INSERT 格式附近的语法不正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚为什么我使用的 BULK INSERT 命令无法识别命令中使用的 FORMAT 和 FIELDQUOTE 选项.

I'm trying to figure out why the BULK INSERT command I'm using isn't recognizing the FORMAT and FIELDQUOTE options used in the command.

BULK INSERT dbo.tblM2016_RAW_Current_Import_File
FROM '\\x\tms\SCADA.dat'
WITH
(
    FIRSTROW = 1,
    FORMAT = 'CSV',
    FIELDQUOTE = '"',
    FIELDTERMINATOR = '\t',
    ROWTERMINATOR = '\n'
)

出于某种原因,我收到错误消息:

For some reason, I'm getting the error:

消息 102,级别 15,状态 1,第 6 行
FORMAT"附近的语法不正确.

Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'FORMAT'.

Addition:FORMAT在SSMS中以粉红色文本显示,FIELDQUOTE以黑色文本显示,其他以蓝色文本显示.由于某种原因,该命令似乎无法将 FORMATFIELDQUOTE 识别为关键字.

Addition: FORMAT shows up in pink text in SSMS, FIELDQUOTE shows in black text, the others show in blue text. It seems the command isn't recognizing FORMAT and FIELDQUOTE as keywords for some reason.

推荐答案

FORMATFIELDQUOTE 说明符在生产服务器中尚不可用.

The FORMAT and FIELDQUOTE specifiers are unfortunately not yet available in production servers.

根据文档:

输入文件格式选项
FORMAT = 'CSV'
适用于: SQL Server vNext CTP 1.1.
指定符合 RFC 4180 标准的逗号分隔值文件.

Input file format options
FORMAT = 'CSV'
Applies to: SQL Server vNext CTP 1.1.
Specifies a comma separated values file compliant to the RFC 4180 standard.

FIELDQUOTE = 'field_quote'
适用于: SQL Server vNext CTP 1.1.

FIELDQUOTE = 'field_quote'
Applies to: SQL Server vNext CTP 1.1.

注意:此答案截至 2017 年 2 月 13 日是最新的.在某个时候,SQL Server vNext"将不再是 CTP 并成为生产服务器.然而,问题与 SQL Server 2016 相关,因此缺少这些功能.

NOTE: This answer is current as of 13th of february 2017. At some point "SQL Server vNext" will cease to be CTP and become production server. The question, however, is in relation to SQL Server 2016 which thus lacks these features.

这篇关于BULK INSERT 格式附近的语法不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆