zoukankan      html  css  js  c++  java
  • 批量导出表索引

     

      批量导出索引:

     

               SELECT   'CREATE  INDEX  ' + [name] 
                        + ' ON [' + OBJECT_NAME(object_id+ '] ('
                        + REVERSE(SUBSTRING(REVERSE(( SELECT    name
                                                                + CASE WHEN sc.is_descending_key = 1 THEN ' DESC'
                                                                       ELSE ' ASC'
                                                                  END + ','
                                                      FROM      sys.index_columns sc
                                                                JOIN sys.columns c ON sc.object_id = c.object_id
                                                                                      AND sc.column_id = c.column_id
                                                      WHERE     OBJECT_NAME(sc.object_idIN (SELECT sysno from IC_History.dbo.temp)
                                                                AND sc.object_id = i.object_id
                                                                AND sc.index_id = i.index_id
                                                      ORDER BY  index_column_id ASC
                                                    FOR
                                                      XML PATH('')
                                                    )), 28000)) + ') With (Online=On)'
               FROM     sys.indexes i
               WHERE    OBJECT_NAME(object_idIN  ('表名' )
                        AND CASE WHEN 1 = 1
                                      AND is_primary_key = 1
                                      AND type = 1 THEN 0
                                 ELSE 1
                            END = 1
                       -- AND is_unique_constraint = 0
                       -- AND is_primary_key = 0

  • 相关阅读:
    实验吧(你真的会PHP吗)CTF之代码审计最终版---解析是错的 我的才是对的
    php的intval函数
    memcached 查看所有的key
    kvm 启动libvirtd时出现错误
    mysql三种binlog日志的理解
    mysql连接提示1030
    执行curl -sSL 提示curl: (35) SSL connect error
    tomcat线程数查看
    docker 1.12.3版本搭建私有仓库,上传镜像报错:server gave HTTP response to HTTPS client”
    memcached安装
  • 原文地址:https://www.cnblogs.com/zping/p/2245807.html
Copyright © 2011-2022 走看看