May 5, 2004 at 3:11 pm
I get the following error message when I try to Shrink the database file in my SQL 2000 database:
DBCC SHRINKFILE ('workplace_onsite_1033_Data', 2000)
Could not locate file 'workplace_onsite_1033_Data' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
But when I check the sysfiles table this is what I get:
SELECT NAME FROM SYSFILES WHERE fileid = 1
workplace_onsite_1033_Data
Even when I try the following statement it gives me the same error message:
DECLARE @FILENAME varchar (255)
SET @FILENAME = (SELECT NAME FROM SYSFILES WHERE fileid = 1)
EXECUTE ('DBCC SHRINKFILE ('+@FILENAME+', 2000, TRUNCATEONLY)')
Could not locate file 'workplace_onsite_1033_Data' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Any Ideas how to fix this problem?
May 6, 2004 at 1:13 am
According to SQL Server Books Online you can either specify the file name or file id, so can't you then use DBCC SHRINKFILE (1, 2000)?
In their example they don't have any quotes around the file name, so maybe it will work if you omit them, e.g.
USE UserDB
GO
DBCC SHRINKFILE (DataFil1, 7)
GO
May 6, 2004 at 5:13 am
Thank you, that took care of the error message.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply