I'm attempting to use the undocumented system procedure sp_MSforeachtable
. But I need to restrict the affected tables to those that start with "smp" and that are in the "dbo
" schema. I was able to find how to find procedures that start with "smp". I simply do:
sp_MSforeachtable @command1=' print ''?''', @whereand=' and name like ''smp%'' '
but how do I filter for a given schema using the @whereand
parameter?
UPDATE: I tried the following but it didn't work:
sp_MSforeachtable @command1=' print ''?''', @whereand=' and name like ''smp%'' and Left(''?'', 5)=''[dbo]'' '
Update 2: I'm running on SQL Server 2000.