每次我在mysql中运行程序时,coumn应该以1开头,然后应该自动生成 [英] each time when i run a program in mysql the coumn should start with 1 and then it should be auto generated

查看:96
本文介绍了每次我在mysql中运行程序时,coumn应该以1开头,然后应该自动生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次当我在vb.net中运行程序时,该列应以1开头,然后应在我的sql表中自动生成.
假设我有一个表table1,其中的字段为tab1,tab2,tab3

each time when i run a program in vb.net the column should start with 1 and then it should be auto generated in the table of my sql.
suppose i have a table table1 with fields tab1,tab2,tab3

tab1 tab2 tab3
1      ggg  jjj
2      jjh   kjjk


当我再次运行vb.net程序时,所有要删除的列和自动生成列tab1应该以1开头. 我不能因为


when i run again the vb.net program all the column to be deleted and the auto generate column tab1 should start with 1.
i cant coz

tab1   tab2   tab3
3      ggg     jjj
4       jjh     kjjk


plz帮助它应该以
开头


plz help it should start with

1    ggg     jjj
2    jjj     kjjk


请帮助.......................


plz help.......................

推荐答案

我认为这是不好的数据库设计.

如果tab1是自动生成的列,则它应要求另一列插入数据(当前tab1数据)

否则发生数据不一致.

谢谢.
I think it is bad database design.

if tab1 is a auto generated column then it should require another column to insert data (current tab1 data)

Otherwise data inconsistency occurred.

Thanks.


您可以使用TRUNCATE TABLE删除表中的所有行并重置自动增量值:
You can use TRUNCATE TABLE to delete all the rows in the table and reset the auto increment value: http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html[^]


这篇关于每次我在mysql中运行程序时,coumn应该以1开头,然后应该自动生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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