_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 碁煙れ企碁煙る貎朱Μ襷り鍵
豢..

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
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

碁伎 螳碁. 螳 覃 覈 蟆 覲. 譟磯 螳 蟯 襷り碓 伎 蟆語 . 蠏殊 る 襷 螻 朱 蠏碁 襷 覲牛蠍 企れ讌. 螳 れる 豎覯る. 螳 殊 訖襴襯 螳襾豪 企.