Create Procedure sp_IndexDefragAllDatabasesTables
As
EXECUTE sp_msforeachdb 'USE [?]
DECLARE @TableName sysname
DECLARE @indid int
DECLARE cur_tblfetch CURSOR FOR
SELECT table_name
FROM information_schema.tables with (nolock)
WHERE table_type = ''base table''
OPEN cur_tblfetch
FETCH NEXT FROM cur_tblfetch INTO @TableName
WHILE @@FETCH_STATUS =...