Reindexing / rebuild Indexes on Linked Server tables I am trying to run the below query to rebuild the index on a table on the Linked server, but it is not working. Can any one please let me know what I am doing wrong?

ALTER INDEX ALL ON [LinkedServerName].[dbname].[dbo].[tablename] REBUILD 
WITH (FILLFACTOR = 90)


This is giving me below error:


  Cannot find the object "[LinkedServerName].[dbname].[dbo].[tablename]" because it does not exist or you do not have permissions.
Four-part-naming syntax is not supported for ALTER INDEX.

Try this:

EXEC ('ALTER INDEX ALL ON [dbname].[dbo].[tablename] REBUILD WITH (FILLFACTOR = 90);') 
AT LinkedServerName;