私は次の管理クエリを継承し、何が返されるかを完全に理解して時々実行しました。
--Loop until the Cursor was not able to fetch
WHILE (@@Fetch_Status >= 0)
BEGIN
--Dump the results of the sp_spaceused query to the temp table
INSERT #TempTable
EXEC sp_spaceused @TableName
--Get the next table name
FETCH NEXT FROM tableCursor INTO @TableName
END
--get rid of the Cursor
CLOSE tableCursor
DEALLOCATE tableCursor
--Select TABLE properties with SIZE -- Final step
SELECT name,
convert(date,create_date) as CreateDate,
convert(date,modify_date) as ModifyDate,
numberofRows,
dataSize
FROM sys.objects
join #temptable tm on
tm.tablename = sys.objects.name
WHERE type in ('U')
order by modify_date
GO
次のフィールドは何ですか?:
- "create_date" ... "CREATE TABLE ..." が実行されたのはいつだと思います
- "modify_date" ...テーブル スキーマが最後に変更されたのはいつですか?
それらのいずれかが、データが最後にテーブルにあったDELETED
かINSERTED
、テーブルにあったかを教えてくれますか?
そうでない場合、どうすればこの情報を取得できますか?