我试图使用下面的代码来执行bulkinsert,我有几个varchar字段、一个标识和一些日期时间、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)
试图将表重命名为没有下划线。如果我试图访问一个不存在的表,则会得到其他错误System.InvalidOperationException: 'Cannot access destination table '[database].[schema].[Table_With_Underline]'.'。
我不知道该怎么做,有可能是关于数据库上的赠款吗?
发布于 2021-10-04 13:06:41
批量操作需要特定的权限。
GRANT ADMINISTER BULK OPERATIONS TO [login]https://stackoverflow.com/questions/69411688
复制相似问题