日期:2011-05-02 15:21:00 来源:本站整理
aboutspaceused[MSSQL防范]
本文“aboutspaceused[MSSQL防范]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
--sql server 6.5/7.0 中有查看某个库中表的占用空间信息功效,但SQL Server 2000中就没有此功效了,偶顺手编了一段语句,权当补缺,但没有排序功效,有爱好的同志可加上排序功效
SET NOCOUNT ON
declare @TableName varchar(200)
create table #tmpTable(name nvarchar(20),rows char(11),reserved varchar(18),data varchar(18),index_size varchar(18),unused varchar(18))
DECLARE myCursor CURSOR FOR select name from sysobjects where type='u'
OPEN myCursor
FETCH NEXT FROM myCursor into @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
insert into #tmptable exec sp_spaceused @TableName
FETCH NEXT FROM myCursor into @TableName
END
CLOSE myCursor
DEALLOCATE myCursor
select * from #tmpTable
drop table #tmpTable
GO
以上是“aboutspaceused[MSSQL防范]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:declare @TableName varchar(200)
create table #tmpTable(name nvarchar(20),rows char(11),reserved varchar(18),data varchar(18),index_size varchar(18),unused varchar(18))
DECLARE myCursor CURSOR FOR select name from sysobjects where type='u'
OPEN myCursor
FETCH NEXT FROM myCursor into @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
insert into #tmptable exec sp_spaceused @TableName
FETCH NEXT FROM myCursor into @TableName
END
CLOSE myCursor
DEALLOCATE myCursor
select * from #tmpTable
drop table #tmpTable
GO
本文地址: | 与您的QQ/BBS好友分享! |
评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论