I'm trying to sort out stats and indexes on our server and I'm running a test on 3 tables to start with (three of our biggest).
I've got the stats bit sorted, but I can't get the code to rebuild the indexes on the 3 specific tables.
This is the code I'm using:-
exec sp_MSforeachtable '
if in (''FACT_iApplicationStat'',''FACT_iAgentBySkillsetStat'',''FACT_iAgentPerformanceStat'')
ALTER INDEX ALL ON REBUILD
I'm getting the following error:-
Msg 207, Level 16, State 1, Line 2
Invalid column name '[dbo].[FACT_iApplicationStatSummary]'.
when it starts the index rebuild.
Can anyone see where I'm going wrong?