View Single Post
  #4 (permalink)  
Old December 23rd, 2005, 08:25 AM
mmcdonal mmcdonal is offline
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

That could be two problems.

The SQL database field for a zip code should be a text or varcahr or char field. It should not be any kind of number field. There should also not be any validation for this field that might cause it to refuse data.

The script should be "typed" at the time the data is read, not when it is processed.

If when you retrieve the data you specify:

myVariable = CStr(csvField)

Then the script will type the variable as a string. If you don't type the variable, then the script may type it and you might get:

myVariable = csvField

If the csvField = "90210" then it is read as the number 90210.
If the csvField = "00210" then it may be read as the number 210.
If the csvField = "90210-4230" then it may be read as 85980.
If the csvField = "00210-4230" then it may be read as -4020.

If these values are typed, then they would be read as "90210", "00210" and "90210-4230" respectively.

If the values are expected to meet certain parameters in the database, and the database will take the record and discard invalid field data, then it may come in as the whole record minus the invalid fields.

It sounds like your script is rejecting the invalid fields before it gets to the SQL server, and the zip field is taking nulls.

HTH



mmcdonal
Reply With Quote