SQLServer

作者: 阳光也学会了妩媚 | 来源:发表于2020-05-22 08:19 被阅读0次

    查询所以表名及行数

        SELECT a.NAME
            ,b.rows
        FROM sysobjects AS a
        INNER JOIN sysindexes AS b ON a.id = b.id
        WHERE (a.type = 'u')
            AND (
                b.indid IN (
                    0
                    ,1
                    )
                )
        ORDER BY a.NAME
            ,b.rows DESC
    

    备份表

    -- xx要备份的表的名称
    SELECT * into xx.bak.2019 from xx 
    

    回复表

     -- 清空原始表
        TRUNCATE table xx;
        -- 从备份表导入数据
        INSERT into xx (a,b)  select a,b from xx.bak.2019
    

    相关文章

      网友评论

          本文标题:SQLServer

          本文链接:https://www.haomeiwen.com/subject/sdufahtx.html