Interesting find today, I have a file group that is used for indexing. It has one file that has a .ldf extension, which as you know for SQL Server, is the extension for the transaction log files.
My understanding is the extensions don't really matter. Whatever is first is first and anything else is secondary regardless of the extension. Does that apply to .ldf in this case when clearly it's being used for the clustered indexes?
I ask because I would assume SQL Server treats .ldf differently than say, mdf's.
(And before you ask, yes, there is already a .ldf assigned for the transaction log on another spindle)
Best Answer
By convention, the following file extensions are used in SQL Server:
Having said that, you're actually free to use any file extension you like for any SQL Server file. In fact, it's completely fine to use no extension at all.
SQL Server does not look at or care about the file name in any way other than that it needs to be compliant with NTFS file name standards.
You can see what files are being used by a database with this query:
Replace
<database_name>
with the name of the database you're concerned about, or remove the entireWHERE
clause to see files for all databases.