我正在尝试使用未记录的系统过程sp_MSforeachtable
。但我需要将受影响的表限制为以“smp”开头且位于“ dbo
”模式中的表。我能够找到如何找到以“smp”开头的程序。我只是这样做:
sp_MSforeachtable @command1=' print ''?''', @whereand=' and name like ''smp%'' '
但是如何使用@whereand
参数过滤给定的模式?
更新:我尝试了以下但没有奏效:
sp_MSforeachtable @command1=' print ''?''', @whereand=' and name like ''smp%'' and Left(''?'', 5)=''[dbo]'' '
更新 2:我在 SQL Server 2000 上运行。