当数据库存在时,TSql dbcc checkident 命令失败
在 SQL Server Management Studio 中运行 dbcc checkident 命令,尝试重置标识列。正如您在下图中清楚地看到的,我的表存在并且架构是默认的 dbo。但是当尝试执行时:
dbcc checkident (Article, RESEED, 4);
我从查询中得到以下响应:
Msg 2501, Level 16, State 45, Line 1
Cannot find a table or object with the name "Article". Check the system catalog.
这对于所有表中的每个表都会发生我的数据库。但这是我正在尝试使用的特定版本。该表确实有数据。我可以做什么/检查?
Running the dbcc checkident
command in SQL Server Management Studio, trying to reset the identity column. As you can see in the picture below clearly my table exists and the schema is the default dbo. But when attempt to execute:
dbcc checkident (Article, RESEED, 4);
I get the following response from the query:
Msg 2501, Level 16, State 45, Line 1
Cannot find a table or object with the name "Article". Check the system catalog.
This happens for every table in all of my databases. But this one is the specific one I'm trying to use. The table does have data in it. What can I do/check?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从注释来看,您的脚本窗口似乎正在
master
数据库的上下文中运行。您需要通过更改下拉列表中的值或运行以下命令来更改数据库的上下文。注意:在 SSMS 中,每个脚本窗口代表一个不同的连接。您可以在状态栏中查看每个窗口的当前数据库上下文、用户名和
spid
等信息。From the comments it seems your script window is running in the context of the
master
database. You need to change the context to your database either by changing the value in the dropdown or running the below.NB: In SSMS each script window represents a different connection. You can look in the status bar to see things like the current database context, user name, and
spid
for each window.