- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 SQL Server 2012 中,以下查询为标识列 myTable_id
设定种子从 2 而不是 1。为什么? myTable_id
也是PK。
DELETE FROM myTable;
GO
SELECT * FROM myTable --0 rows are returned as expected
GO
DBCC CHECKIDENT(myTable, RESEED,1)
GO
INSERT INTO myTable(col1,col2,col3) SELECT FROM AnotherTable(col1,col2,col3)
GO
SELECT * FROM myTable --1005 rows are returned as expected, but identity value starts from 2
GO
DBCC CHECKIDENT(myTable, RESEED,0)
标识列正确地从 1 开始。myTable_id
的 SSMS 快照栏目:最佳答案
来自 docs :
The seed value is the value inserted into an identity column for the very first row loaded into the table. All subsequent rows contain the current identity value plus the increment value where current identity value is the last identity value generated for the table or view.
关于sql-server - DBCC CHECKIDENT(myTable, RESEED,1) 从 2 重新播种,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45618332/
DBCC CHECKIDENT(N'dbo.Orders', RESEED, 0); DBCC CHECKIDENT 语法 DBCC CHECKIDENT (&
我有一个表,它有一个 id,它既是表的身份又是表的主键。什么时候运行这个 Use devdb Select * from tablename order by did desc 有效,我看到了数据。当
我正在尝试利用 Consul .NET API 通过 TTL 注册和启动运行状况检查。首先,我使用以下代码注册我的服务: var address = node.Address; var id = Se
在每次 DAO 测试之前,我都会清理我的数据库,并且我需要重置一些表的标识值。我创建了以下存储过程: CREATE PROCEDURE SET_IDENTITY @pTableName
我正在使用 Windows Azure Sql。 我已使用 DBCC CHECKIDENT ('Table_Name', RESEED, 1) 重新设定表的种子。没有主键为 36 的行。当我尝试插入行
我正在尝试做这样的事情: declare @myCurrentSeedValue int; select @myCurrentSeedValue = DBCC CheckIdent('MyTable'
我有一个不同的架构(除了 dbo 之外),我在其中创建了一个表,架构“Chemical”。 我尝试了此 DBCC CHECKIDENT 的 4 种不同变体,它们都返回相同的错误: “‘.’附近的语法不
我使用此代码来重置表上的身份: DBCC CHECKIDENT('TableName', RESEED, 0) 这在大多数情况下工作正常,第一次插入时我将 1 插入到 Id 列中。但是,如果我删除数据
目前在某些操作上我必须删除旧数据并插入新数据。但我注意到尽管删除了数据,但身份列并未重置并从其最后一个最大值继续。所以我使用 DBCC CheckIdent 来实现所有这一切都发生在交易中。我可以将交
对于我的单元测试,我有一个自动化过程,可以逐表构建数据库的副本。我首先运行 SELECT INTO 并添加主键和任何索引。 我用数据复制了一些表,对于那些没有数据的表,我希望重置身份种子。 为了实现这
我读到的有关重新播种的所有文档都表明了以下内容: SET @maxIdentityValue = (SELECT MAX(id) FROM 表名) 运行DBCC CHECKIDENT('表名', RE
这是我第一次在这里提出问题,但我过去曾多次使用 stackoverflow 来寻找代码中遇到的问题的解决方案。 我正在一个 php 站点上的数据库传输页面上工作,该页面上传 csv 文件并更新数据库,
我以非 sa 用户“bhk”身份登录到 SQL Server 2005 数据库,该用户仅是“公共(public)”服务器角色的成员。以下代码尝试在用户“bhk”调用的存储过程中执行。这行代码... T
在 SQL Server 2012 中,以下查询为标识列 myTable_id 设定种子从 2 而不是 1。为什么? myTable_id也是PK。 DELETE FROM myTable; GO S
使用 SQL Server 数据库。使用数据库版本控制工具向查找表添加了 50 个新项目,因此将在所有三个数据库上运行相同的脚本。数据库有 Dev、QA 和 Prod 版本,由于政治原因,prod 无
我是一名优秀的程序员,十分优秀!