豢..

select 
    c.name + '.' + a.name table_name
,   e.row_count
,   'create clustered index cix_' + d.name + ' on ' + 
    c.name + '.' + a.name + '(' + d.name + ') with (data_compression = page)' + char(13) + char(10) + 'go' + char(13) + char(10) create_index
from sys.all_objects a
    left join sys.indexes b
        on a.object_id = b.object_id     
        and b.type > 0
    inner join sys.schemas c
        on a.schema_id = c.schema_id
    inner join sys.all_columns d
        on a.object_id = d.object_id
    inner join (
        select
            object_id, sum(row_count) row_count
        from sys.dm_db_partition_stats
        group by
            object_id
    ) e
        on a.object_id = e.object_id
where b.object_id is null
and a.type = 'U'
and a.is_ms_shipped = 0
and c.name not in ('temp')
and d.name in ('std_dt', 'date_key')
order by e.row_count desc