重新安排号码 [英] re arrange number

查看:93
本文介绍了重新安排号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是Jyotin.
我正在使用ms Access数据库创建基于vb Windows的项目.
我正在使用运行良好的删除查询.
但我的问题是------
我想在删除后重新排列数据表.
as-i具有slno 1,2,3,4,5,6的行.
删除1,5行后,它变为2,3,4,6.
我希望它应该是1,2,3,4,这意味着剩余的行应从1开始重新排列.

请回复.

hello everybody,

i am Jyotin.
i am creating a vb windows based project with ms access database.
i am using delete query which is working well.
but my problem is------
i want to re-arrange the datatable after deletion.
as-i have rows having slno 1,2,3,4,5,6.
after delting 1,5 row,it becomes 2,3,4,6.
i want that it should be 1,2,3,4 means remaining rows should be re-arrange staring from 1.

please reply.

thanks alot.

推荐答案

好,行号必须是一个Identity列,并且必须是自动递增的.如果是这样,则不能直接更改它.

如果是行号,则在插入时由您提供,那么您可以尝试根据需要进行全部更改.但是,那么,您需要谨慎维护引用完整性(如果有). (即,引用该表的其他表也必须更改)

现在,如何为表格执行此操作:
您可以使用光标来实现.
Well, the RowNumbers must be an Identity column and auto-incremental. If so, you cannot change it directly.

If, it is a RowNumbers are provided by you at time of insertion then you can try to change for all as you need. But then, you need to be careful to maintain referential integrity if any. (i.e. other tables referencing it must also be changed)

Now, How to do this for a table:
You can use Cursors to achieve it.


这篇关于重新安排号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆