Using SqlBulkCopy, how do I insert data into a table in a non-default database schema?
I need to insert data into a table in a schema named Staging using SqlBulkCopy.
It appears the API only allows you to set the target table name by using the DestinationTableName property.
How do I accomplish this? Is it possible?
Given that BULK INSERT has always supported a fully-qualified table name, it seems like a big oversight that those separate components never made it into the API.
Moreover, as it appears that DestinationTableName is simply output into a BULK INSERT statement, this property may be vulnerable to SQL injection. So if you're getting this information from a user at some point, make sure to sanitize the input before running this operation.