Can someone please help.

I have a dataset that is populated with a csv or a tab seperated txt. I get the datset fine but when I try to insert into a table in sql with bulkinsert I am getting an exception.

The table does not allow nulls in the column. So what I need help with is scanning the dataset for a null value and replacing with an empty string or int value.

I spent some time looking around and found some code that will testif a column has a null value but I cannot seem to find the values and replace them.

Any help would be appreciated.

I will post some code a little later, just not on my work computer right now.

Thanks in advance

9 Years
Discussion Span
Last Post by Ramy Mahrous

You can solve it using default on database side, if you insert null value it automatically replaced by a specified value.


I wish that were true because it has a default of an empty string.

Thanks tho. I am looking into this more and I cannot seem to find a way to scan the entire dataset for dbnulls.

Man I wish this were a oneoff, I would just edit the file...lol

Thanks again, hopefully I can get this worked out.


Edit the file:|!!!!!!! I don't like such solutions! Any way mark it as solved if you want to dicuss more about this problem reply...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.