Skip navigation

Finding File-Creation Time

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 Files\Microsoft SQL
Server\MSSQL$SQL2000_1\data\pubs.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.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish