Sqlbulkcopyoptions.firetriggers不会触发表中的触发器 [英] Sqlbulkcopyoptions.firetriggers does not fire trigger in the table

查看:396
本文介绍了Sqlbulkcopyoptions.firetriggers不会触发表中的触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新添加了触发器的表。



当我尝试运行批处理文件并使用

I have a table with triggers newly added to it.

When I try to run a batch file and upload the file using

SqlBulkCopy

上传文件时,它无效。

在看完添加

it did not work.
After reading that adding

SqlBulkCopyOptions.FireTriggers 

将触发设置到表的触发器后,我添加了它。



但我仍然得到同样的错误 - '

will fire the triggers that are set to the table, I added it.

But still I get the same error - '

Bulk copy failed. User does not have ALTER TABLE permission on table. ALTER TABLE permission is required on the target table of a bulk copy operation if the table has triggers or check constraints, but 'FIRE_TRIGGERS' or 'CHECK_CONSTRAINTS' bulk hints are not specified as options to the bulk copy command.

'



知道要做什么吗?任何帮助将不胜感激



我尝试过:



'

Any idea what is to be done? Any help would be appreciated

What I have tried:

using (var bulkCopy = new SqlBulkCopy(connection, SqlBulkCopyOptions.FireTriggers))

推荐答案

我假设您使用的是SQL服务器,错误可能意味着您应该以管理员运行程序或具有正确的SQL Server权限。

有关 SQL Server权限的详细信息我建议你阅读一本关于它的书,或者看看这里: SQL Server中的服务器和数据库角色| Microsoft Docs [ ^ ]
I assume you are using SQL Server, the error means probably that you should be running the program as an administrator or have the correct SQL Server rights.
For more information on SQL Server rights I recommend you to read a book about it, or take a look here: Server and Database Roles in SQL Server | Microsoft Docs[^]


这篇关于Sqlbulkcopyoptions.firetriggers不会触发表中的触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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