Foxpro中如何自动增加一个字段
我正在使用 vfp9,但该程序可能是用更早的语言编写的。 当我通过 vfp 打开数据库时,该字段是只读的,与其他字段不同。 手动执行此操作(选择 max + 1)对插入不起作用,它只会使字段 = 0。
我在网上查找正确语法的示例时遇到困难,有人可以帮忙吗?
编辑: 好的,解决方案是将字段留空。该字段位于一个表中,该表最终会附加到一个更大的表(带有自动编号字段的表)。不过,在附加之前,该字段已用于多次搜索。
我不想通过简单地在附加之前将字段设置为 null 来修复所有代码。但是,将字段替换为 null
会出现错误。 将表字段设置为空的正确语法是什么?
再次编辑:删除列有效。显然你不能将数字字段设置为空。
I'm using vfp9 but the program may have been written in an earlier language.
When i open up the database through vfp, the field is read only, unlike the other fields.
Doing it manually (select max + 1) doesn't work on the insert, it just makes the field = 0.
I'm having trouble finding examples online for the proper syntax, can anyone help?
Edit:
OK, the solution was to leave the field blank. The field is in a table that is eventually appended to a larger table (the one with an autonumber field). Before it's appended, the field is used in several seeks, though.
I'd prefer not to fix the code everywhere by simply setting the field to null before the append. replace field with null
gives an error though. What's the proper syntax for setting a table field to null?
Edit again: dropping the column worked. Apparently you can't set a number field to null.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的表结构如下:
count字段设置为允许为空,那么您可以使用以下任意一种方法将整数类型的字段设置为空值。
If your table structure is as follows:
The count field is set to allow nulls, so you can set a field of type integer to a null value using any of the following methods.
我将执行以下 SQL 查询:
I would perform the following SQL queries: