Parsing error
cbondeson
Posts: 12 Bronze 2
We have an sp which assesses information_schema.tables. The parser indicates that "tables" is an "Unresolved Internal Reference" ,"object not found". The sp text follows:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE proc dbo.DatabaseReIndex AS
--Script to automatically reindex all tables in a database
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'base table'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
@FETCH_STATUS = 0
BEGIN
--PRINT "Reindexing " + @TableName
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE proc dbo.DatabaseReIndex AS
--Script to automatically reindex all tables in a database
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'base table'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
@FETCH_STATUS = 0
BEGIN
--PRINT "Reindexing " + @TableName
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
GO
Comments
Thanks for the feedback. This is a known problem: since we don't pull in system objects, and this includes the INFORMATION_SCHEMA views, these always appear as unresolved objects.
The workaround for now is just to hide them, however I imagine we might well fix this in a future release. I'll add this to our bug tracking system at any rate.
Many thanks,
Principal Consultant
bartread.com Ltd