Microsoft KB Archive/140654

= PRB: ODBC Error: Column in Table May Not Be Null =

Article ID: 140654

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Data Access Components 2.5

-



This article was previously published under Q140654



SYMPTOMS
When committing a new record to a remote view, you may receive this error:

Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]

The column in table may not be null.

Where is the name of the remote data's field and is the name of the table to which the record is being added.



CAUSE
This error can occur for two reasons:


 * When you add a record to a remote table, all fields in the view must be marked as updatable. Usually the key field is not marked as updatable by default, which will cause this error to occur with being the name of the key field. -or-


 * The new record is not completely entered with data and one of the fields is updated as .NULL. instead of being given a valid value for the data type. For example a SQL Server bit data type cannot accept .NULL. values; it requires a logical True (.T.) or False (.F.) to be in the Visual FoxPro remote view. If it isn't, will be the name of the field that requires a non-null value.



RESOLUTION
Mark the key field as updatable or fill the field that can't support null values with valid data.



STATUS
This behavior is by design.



Steps to Reproduce Behavior

 * 1) Using View Designer, create a remote view to the Authors table in the SQL Server Pubs database. Select all fields in the table by double- clicking the asterisk (*) in the table window. Click the Update Criteria tab and make the Au_id field the key field. Click Update All. Make sure there is no check mark in the Update and Pencil columns of the field name list.
 * 2) Click Send SQL Updates.
 * 3) Run the View. Press CTRL+Y to add a record. Add data to the first three fields of the record.
 * 4) Use the keyboard or mouse to select another record. The error will occur.
 * 5) Use =TABLEREVERT to reverse the change.
 * 6) Type USE in the Command window to close the cursor.
 * 7) Go back to View Designer. Make the key field updatable.
 * 8) Follow the steps again. Notice the error is the same, but now it is pointing to the Contract field. This field cannot except a null value. It must be either true or false. Once this value has been entered, you can leave the record without error.

Additional query words: 3.0b VFoxWin

Keywords: kbprb KB140654

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.