当前位置:Gxlcms > 数据库问题 > SQL Server一些常见却不太记得住的命令

SQL Server一些常见却不太记得住的命令

时间:2021-07-01 10:21:17 帮助过:2人阅读

一、数据库大小查询

1. exec sp_spaceused ‘表名‘          --(SQL统计数据,大量事务操作后可能不准)
2. exec sp_spaceused ‘表名‘, true       --(准确的表空间大小,但可能会花些统计时间)
3. exec sp_MSforeachtable "exec sp_spaceused ‘?‘"     --(所有用户表空间表大小,SQL统计数据,,大量事务操作后可能不准)
4. exec sp_MSforeachtable "exec sp_spaceused ‘?‘,true"    --(所有用户表空间表小,大数据库慎用)

二、清空表数据

1.TRUNCATE TABLE table_name

2.delete from table_name

SQL Server一些常见却不太记得住的命令

标签:

人气教程排行