如何从SQL Server 2008到Visual Studio 2010提取数据 [英] How to fetch data from sql server 2008 to visual studio 2010

查看:104
本文介绍了如何从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)


这篇关于如何从SQL Server 2008到Visual Studio 2010提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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