Solved Error when trying to reseed table (1 Viewer)

NearImpossible

Registered User.
Local time
Today, 00:32
Joined
Jul 12, 2019
Messages
225
Trying to run
SQL:
dbcc checkident (NewFacility, reseed, 0)
and getting the following error, even though the table exists.

Msg 2501, Level 16, State 45, Line 1
Cannot find a table or object with the name "NewFacility". Check the system catalog.


Any thoughts??
 

Attachments

  • tables.PNG
    tables.PNG
    2.4 KB · Views: 115

Minty

AWF VIP
Local time
Today, 06:32
Joined
Jul 26, 2013
Messages
10,371
Think you need to include the table name in single quotes

dbcc checkident ('NewFacility.thefieldname', reseed, 0)

Edit - Actually also include the field name
 

NearImpossible

Registered User.
Local time
Today, 00:32
Joined
Jul 12, 2019
Messages
225
Think you need to include the table name in single quotes

dbcc checkident ('NewFacility', reseed, 0)

Tried it with single quotes, dbcc checkident ('NewFacility', reseed, 0) turns the table name red and get the same error. Tried it with double quotes,dbcc checkident ("NewFacility", reseed, 0) name doesn't change color, but still get the same error
 

Minty

AWF VIP
Local time
Today, 06:32
Joined
Jul 26, 2013
Messages
10,371
See my edit, include the field name as well.
Example From MSDN - make sure the query is connected to the right database as well.
SQL:
USE AdventureWorks2012; 
GO 
DBCC CHECKIDENT ('Person.AddressType', RESEED, 10); 
GO
 

NearImpossible

Registered User.
Local time
Today, 00:32
Joined
Jul 12, 2019
Messages
225
See my edit, include the field name as well.
Example From MSDN - make sure the query is connected to the right database as well.
SQL:
USE AdventureWorks2012;
GO
DBCC CHECKIDENT ('Person.AddressType', RESEED, 10);
GO

same thing,

One thing I did forget to mention was I am still developing my database in access and this table was up to 41 records and then when I added a new row to test out a new form, it appeared to start over at 1 so wondering if the table somehow got corrupt
 

NearImpossible

Registered User.
Local time
Today, 00:32
Joined
Jul 12, 2019
Messages
225
See my edit, include the field name as well.
Example From MSDN - make sure the query is connected to the right database as well.
SQL:
USE AdventureWorks2012;
GO
DBCC CHECKIDENT ('Person.AddressType', RESEED, 10);
GO

When identifying the DB to use,
SQL:
use Tracker2;
GO
checkident('NewFacility.FacilityID', reseed, 0)
GO

I get the following

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'NewFacility.FacilityID'.

Also Checkident is underlined and when I mouse over it, it states "could not find stored procedure 'Checkident'
 

NearImpossible

Registered User.
Local time
Today, 00:32
Joined
Jul 12, 2019
Messages
225
Figured it out, forgot the dbo. eventhought I could have sworn I tried that first

SQL:
DBCC CHECKIDENT ('dbo.NewFacility', RESEED, 0);
 

Minty

AWF VIP
Local time
Today, 06:32
Joined
Jul 26, 2013
Messages
10,371
Figured it out, forgot the dbo. eventhought I could have sworn I tried that first

SQL:
DBCC CHECKIDENT ('dbo.NewFacility', RESEED, 0);

That was going to be my first suggestion but none of the documentation used it, so I stupidly assumed not required. 🤦‍♂️ :rolleyes:
 

Users who are viewing this thread

Top Bottom