Reputation: 1266
I have table that has an id which both an identity AND primary key of a table. When run this
Use devdb
Select * from tablename order by did desc
works and I see the data. When I run the following, I see the table in list
Use devdb
SELECT * FROM information_schema.tables order by TABLE_NAME
But when I run this:
Use devdb;
DBCC CHECKIDENT ('<TableName>.<ColumnName>', RESEED, 100000);
I get
Msg 2501, Level 16, State 45, Line 2
Cannot find a table or object with the name "<tablename>.<columnname>". Check the system catalog.
Anyone know why?
Upvotes: 3
Views: 5872
Reputation: 11
If your schema is not default ('dbo.TableName'), the command will fail. Make sure your use the correct ('schemaName.tableName') context
Upvotes: 0
Reputation: 3456
Check out the documentation for CHECKIDENT. It only takes in a table name because tables are restricted to only a single identity column so there is no need to give a column name. Just run:
Use devdb;
DBCC CHECKIDENT ('<TableName>', RESEED, 100000);
Upvotes: 7