Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rows with null values in csv missing in table

Status
Not open for further replies.

tmh

Technical User
Mar 6, 2001
8
0
0
US
I am importing data into Access from a csv file. The problem is, one of the fields in a certain column is sometimes blank (null). When reading the data into the access table, the rows where the values are null do not come into the table. How can I fix this problem? Thanks! Here is the code I am using:
$SqlStatement = ("INSERT INTO cust_sum_da " .
"(CustomerNumber, SalesMTD, CashMTD, noinvtd BalanceForward, TotalBalance, LastStatement) " .
"VALUES ('$one', '$ten', '$eleven', '$twelve', '$thirteen', '$fourteen', '$fifteen') ");
$db->Sql($SqlStatement);

The noinvtd field , read in as $twelve, is the one that occasionally has a null value.

ALSO, I think when reading in the csv it thinks that the first row of information is headings and no matter what, it never reads in the first line of data. Does anyone know the way to get around that???

TMH



 
I think you would have better luck trying this in an Access forum - both of your questions are quite specific to Access. Malcolm
 
I found a "work around". Luckily the field will contain a number, so I took the text string and added 0 to it. I did this before the sql statement that imports it into the database. This forced the value to 0 when it was originally null. Anyway, thanks Malcolm. I am going to post this in the Access forum and see if I get a true fix in place of my "work around".

tmh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top