SQLServer
2020-05-22 本文已影响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