Is it true that SQL SqlBulkCopy does not remove leading spaces from columns?

sql sqlbulkcopy

Question

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!

1
1
11/22/2011 8:29:04 PM

Popular Answer

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.

0
12/8/2011 6:21:09 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow