Skip to content

Optional ORDER hints for SqlBulkCopy#540

Merged
cheenamalhotra merged 42 commits intodotnet:masterfrom
johnnypham:bulkCopyOrderHints
Jun 10, 2020
Merged

Optional ORDER hints for SqlBulkCopy#540
cheenamalhotra merged 42 commits intodotnet:masterfrom
johnnypham:bulkCopyOrderHints

Conversation

@johnnypham
Copy link
Copy Markdown
Contributor

@johnnypham johnnypham commented Apr 24, 2020

For #23

ORDER ( { column [ ASC | DESC ] } [ ,... n ] ) Specifies how the data in the data file is sorted. Bulk import performance is improved if the data being imported is sorted according to the clustered index on the table, if any. If the data file is sorted in a different order, that is other than the order of a clustered index key or if there is no clustered index on the table, the ORDER clause is ignored. The column names supplied must be valid column names in the destination table. By default, the bulk insert operation assumes the data file is unordered. For optimized bulk import, SQL Server also validates that the imported data is sorted.

insert bulk, which SqlBulkCopy uses, will return an error message when an ORDER hint is given for an identity column and the query is not executed. This differs from BULK INSERT, which ignores the ORDER hint but still executes the query.

@johnnypham johnnypham added the Public API 🆕 Issues/PRs that introduce new APIs to the driver. label Apr 24, 2020
@dnfclas
Copy link
Copy Markdown

dnfclas commented Apr 24, 2020

CLA assistant check
All CLA requirements met.

Comment thread doc/samples/SqlBulkCopy_ColumnOrderHint.cs Outdated
Comment thread doc/samples/SqlBulkCopy_ColumnOrderHintColumn.cs Outdated
Comment thread doc/samples/SqlBulkCopy_ColumnOrderHintSortOrder.cs Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHint.xml Outdated
Comment thread src/Microsoft.Data.SqlClient.sln
Comment thread src/Microsoft.Data.SqlClient/netfx/src/Resources/Strings.resx Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/OrderHint.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/OrderHint.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/OrderHint.cs Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHint.xml Outdated
Comment thread src/Microsoft.Data.SqlClient.sln Outdated
@DavoudEshtehari DavoudEshtehari self-requested a review April 28, 2020 02:40
Comment thread src/Microsoft.Data.SqlClient.sln Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/OrderHint.cs Outdated
@cheenamalhotra cheenamalhotra added this to the 2.0.0 milestone May 4, 2020
Comment thread src/Microsoft.Data.SqlClient.sln Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopy.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHint.xml Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHintCollection.xml Outdated
Comment thread src/Microsoft.Data.SqlClient.sln Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs Outdated
Comment thread doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopy.xml Outdated
Comment thread src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlBulkCopy.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Public API 🆕 Issues/PRs that introduce new APIs to the driver.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants