批量插入txt文件
有一个 txt 文件,必须将其传递给 sql
当我运行命令时
insert into tb WITH (FIRE_TRIGGERS) (sField)
select sField
FROM OPENROWSET( BULK 'C:\import\file.txt',
FORMATFILE ='C:\import\tbl.xml'
)
as t1
,出现输出错误: “FIRE_TRIGGERS”选项无法识别表提示。
有人知道我如何实现这一目标吗?
谢谢。
have a txt file and have to pass it to sql
When I run the command
insert into tb WITH (FIRE_TRIGGERS) (sField)
select sField
FROM OPENROWSET( BULK 'C:\import\file.txt',
FORMATFILE ='C:\import\tbl.xml'
)
as t1
I get output error:
"FIRE_TRIGGERS" option is not recognized table hints.
Anyone any ideas how I can achieve this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OPENROWSET BULK 的行为与 BULK INSERT 不同。它的行为更接近于 SELECT 和 INSERT,这就是您上面实际执行的操作。
默认情况下,INSERT 应用触发器。
有一个表提示
IGNORE_TRIGGERS
可以覆盖它。因此,只需删除
WITH (FIRE_TRIGGERS)
提示,触发器就会触发。拉塞尔
OPENROWSET BULK behaves differently to BULK INSERT. Its behaviour is closer to SELECT and INSERT and that is the operation you are actually performing above.
By default, INSERT applies triggers.
There is a table hint to
IGNORE_TRIGGERS
to override this.So just remove the
WITH (FIRE_TRIGGERS)
hint and the triggers should fire.Russell