-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Pri2Indicates issues/PRs that are medium priorityIndicates issues/PRs that are medium priorityarea-System.Data.SqlClientdotnet-api/produntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
It is worth adding that the destination table cannot be a synonym (as demonstrated by the code below). (It seems weird that this should be the case)
Sql:
drop table if exists myschema.SimpleTable
drop schema if exists myschema;
go
create schema myschema;
go
create table myschema.SimpleTable(Id int);
go
drop synonym if exists dbo.SimpleTable;
go
create synonym dbo.SimpleTable for myschema.SimpleTable;
go
C#:
var tblData = new DataTable();
tblData.Columns.Add("Id", typeof(int));
for (var i = 0; i < 100; i++) tblData.Rows.Add(i);
using (var sqlBulkCopy = new SqlBulkCopy(connectionString) {DestinationTableName = "SimpleTable"})
sqlBulkCopy.WriteToServer(tblData);
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 3d74ea27-ced0-04cf-d0cf-ef8657e5b7e7
- Version Independent ID: 218cca08-9c97-9a81-27c2-e4ae737ec118
- Content: SqlBulkCopy.DestinationTableName Property (System.Data.SqlClient)
- Content Source: xml/System.Data.SqlClient/SqlBulkCopy.xml
- Product: dotnet-api
- GitHub Login: @douglaslMS
- Microsoft Alias: douglasl
Metadata
Metadata
Assignees
Labels
Pri2Indicates issues/PRs that are medium priorityIndicates issues/PRs that are medium priorityarea-System.Data.SqlClientdotnet-api/produntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner