So Im using SqlBulkCopy to insert records into my database, but when doing so it is removing any leading spaces in my column. Is there a way for it not to do so? Please help!
I have used SqlBulkCopy many times and have never encountered a scenario where the leading spaces were removed. In fact to achieve this I have had to explicitly find records with leading spaces and remove them. Can you provide more information like the scenario in which you are encountering this please?
If your source is a text file and you are probably using an OleDb text driver, then the OleDb trims the spaces, therefore you might want to check if the spaces are being trimmed before its sent to SqlBulkCopy.