Finding File-Creation Time
SQL Server doesn't store file-creation times in the system tables. However, if you have a database file's full name you can acquire the file's creation time by using xp_getfiledetails.
June 21, 2004
Does SQL Server keep track of when new files and filegroups are added to or removed from a database, maybe in the form of a timestamp in the catalog? If so, how can I access that information?
SQL Server doesn't store file-creation times in the system tables. However, if you have a database file's full name, you can retrieve the file's creation time by using xp_getfiledetails:
EXEC master..xp_getfiledetails 'C:Program FilesMicrosoft SQLServerMSSQL$SQL2000_1datapubs.mdf'
The command's result set will tell you when the file was created, among other things. This technique won't work for retrieving filegroup creation times, however, because filegroups don't have a physical structure at the OS level. I don't know of any way to determine when a filegroup was created or when a particular file was added to a filegroup.
About the Author
You May Also Like