SqlBulkCopy.WriteToServer 作品需要哪些 GRANTS?
Which GRANTS are necessary to SqlBulkCopy.WriteToServer works?
我正在尝试使用下面的代码来执行 bulkinsert,我有几个 varchar 字段、一个 Identity 和一些 datetime、int 和 float 字段
using DataTable test = logs.ConvertToDataTable();
using SqlConnection connection = (SqlConnection)_connectionFactory.GetDatabaseConnection();
SqlBulkCopy bulk = new SqlBulkCopy(connection, SqlBulkCopyOptions.Default, null);
bulk.DestinationTableName = "[database].[schema].[Table_With_Underline]";
connection.Open();
bulk.WriteToServer(test);
我在最后一行遇到错误
System.InvalidOperationException: 'Failed to obtain column collation information for the destination table. If the table is not in the current database the name must be qualified using the database name (e.g. [mydb]..[mytable](e.g. [mydb]..[mytable]); this also applies to temporary-tables (e.g. #mytable would be specified as tempdb..#mytable)
试图将 table 重命名为不带下划线。如果我尝试访问不存在的 table 我会收到其他错误
System.InvalidOperationException: 'Cannot access destination table '[database].[schema].[Table_With_Underline]'.'
我不知道该怎么办,可能是关于数据库的授权?
批量操作需要特定权限。
GRANT ADMINISTER BULK OPERATIONS TO [login]
我正在尝试使用下面的代码来执行 bulkinsert,我有几个 varchar 字段、一个 Identity 和一些 datetime、int 和 float 字段
using DataTable test = logs.ConvertToDataTable();
using SqlConnection connection = (SqlConnection)_connectionFactory.GetDatabaseConnection();
SqlBulkCopy bulk = new SqlBulkCopy(connection, SqlBulkCopyOptions.Default, null);
bulk.DestinationTableName = "[database].[schema].[Table_With_Underline]";
connection.Open();
bulk.WriteToServer(test);
我在最后一行遇到错误
System.InvalidOperationException: 'Failed to obtain column collation information for the destination table. If the table is not in the current database the name must be qualified using the database name (e.g. [mydb]..[mytable](e.g. [mydb]..[mytable]); this also applies to temporary-tables (e.g. #mytable would be specified as tempdb..#mytable)
试图将 table 重命名为不带下划线。如果我尝试访问不存在的 table 我会收到其他错误
System.InvalidOperationException: 'Cannot access destination table '[database].[schema].[Table_With_Underline]'.'
我不知道该怎么办,可能是关于数据库的授权?
批量操作需要特定权限。
GRANT ADMINISTER BULK OPERATIONS TO [login]