且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法插入表格的某些列

更新时间:2023-11-30 20:06:04

表中的RKey列不允许使用NULL值。

当您插入新记录时不提供此字段的值,数据库将值设置为NULL。



因此您有3个选项;

a)编辑接受NULL值的字段如下

1)打开SQL企业管理器

2)右键单击表&选择设计

3)滚动到列&勾选Allow Nulls字段

4)关闭表格 - 提示保存时单击是

b)设置字段的默认值

1 )打开SQL企业管理器

2)右键单击表&选择设计

3)选择正确的列

4)根据字段类型设置默认值或Binding字段

5)关闭table - 提示保存时单击Yes

c)更新您的Insert语句如下(仅示例)

The column RKey in your table does not allow a NULL value.
When you insert a new record & do not provide a value for this field, the database will set the value to NULL.

Therefore you have 3 options;
a) Edit the field to accept a NULL value as follows
1) Open SQL Enterprise Manager
2) Right-click the Table & select Design
3) Scroll to the column & tick the Allow Nulls field
4) Close the table - click Yes when prompted to save
b) Set a Default value for the field
1) Open SQL Enterprise Manager
2) Right-click the Table & select Design
3) Select the correct column
4) Set the Default value or Binding field based on the field type
5) Close the table - click Yes when prompted to save
c) Update your Insert statement as below (example only)
Insert into tempWIPAeroV1 (WIPMATL,WIP_sold, RKey) (select Material_cost ,Sold_cost, RKEY  from NewValues  join tempWIPAeroV1 on  tempWIPAeroV1.RKEY = NewValues.RKEY )





亲切的问候



Kind Regards


INSERT INTO tempWIPAeroV1 (WIPMATL,WIP_sold, RKey)
                (SELECT Material_cost ,Sold_cost,ISNULL(tempWIPAeroV1.RKEY,'') AS RKey  
                 FROM NewValues
                 LEFT JOIN tempWIPAeroV1 ON  (tempWIPAeroV1.RKEY = NewValues.RKEY) );