SQL Server Performance Forum – Threads Archive
Error running extended stored procedureI get an error when I try to run the following comand in 2005
exec sp_MSForEachtable @command1=’select count(*) from ”?” ‘
the error is
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ‘[dbo].[TableName]’.
This error is repeated for each table.
If I run
exec sp_MSForEachtable @command1=’print ”?”’
it works fine. This command works fine under 2000.
Does anyone know what would cause this?
exec sp_MSForEachtable @command1=’select count(*) from ? ‘ —————————————-
I get the same error
It is an undocumented stored procedure, so no notes available and reference about whether it will work on SQL2005. If you need information then information_schema.tables is preferred because that syntax will work with SQL Server 2005 and using systables will break! Satya SKJ
Contributing Editor & Forums Moderator
This posting is provided â€œAS ISâ€ with no rights for the sake of knowledge sharing.