About "Space Used"

zhaozj2021-02-16  63

- SQL Server 6.5 / 7.0 has the occupancy spatial information feature of the table in a library, but there is no such function in SQL Server 2000, even with a statement, the right, but there is no sorting function, interested Comrade can add a sort function

Set NoCount Ondeclare @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 myCursorFETCH NEXT fROM myCursor into @TableNameWHILE @@ FETCH_STATUS = 0BEGIN insert into #tmptable exec sp_spaceused @TableName FETCH NEXT fROM myCursor into @TableNameENDCLOSE myCursorDEALLOCATE myCursorselect * from #tmpTabledrop table # TMPTABLEGO

转载请注明原文地址:https://www.9cbs.com/read-23807.html

New Post(0)