如何从SQL Server 2008到Visual Studio 2010提取数据

如何从SQL Server 2008到Visual Studio 2010提取数据

问题描述:

我有一个名为采购的数据库和5个表,分别名为e1,e2,material_master,material_group和project.

在e1表中,有一个名为sl_no的列名,它是主键,我希望它具有唯一且不同的值.

问题是,当我从sql server设置自动增量时,它会自动更改值,但是当我更改为其他项目时,它也会继续增加序列号.请帮助我如果我更改项目,它必须调用相应数据库中的最后一个值,并且必须在最后一个被调用的序列号中加1".

I am having a database called procurement and 5 tables named as e1, e2, material_master, material_group and project.

In the e1 table there is a column name called sl_no which is the primary key and i want it to have unique and different values.

the problem is when i put auto increment from the sql server it automatically changes the value but when i change to a different project also it is continuing to increase the serial number. Please help me "if i change the project it must call the last value in the respective database and have to add 1 to the last called serial number".

您可以使用
将标识列的值重置为1
You can reset the identity column value to 1 by using
DBCC CHECKIDENT (Table_1, RESEED, 1)