
How to check the index is disabled or enabled
In this article, we will show you two ways to check whether […]
By Muhammad Kamran | Published
It is pretty much straightforward to find database file location in SQL Server. When a database is created in SQL Server, two files are automatically created, a data file and a log file. SQL Server database stores data in these two types of files, a data file (MDF) and a transaction log file (LDF).
There is a default database file location for instances depending on the Microsoft SQL Server version. Below are examples of default SQL database file locations for SQL Server 2016, SQL Server 2017, and SQL Server 2019.
SQL Server 2016 — C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\
SQL Server 2017 —C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\
SQL Server 2019 —C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\
You can use the Microsoft SQL Server Management Studio (SSMS) to locate the SQL server database files.
Open the SQL Server Studio Management, right-click on the database, and then select Properties as shown in the below screenshot.
A new window will appear, select the files page and you will see the data file and log files location.
Another way to find the database file location is to run a TSQL query. Right-click on the SQL Instance and click on New Query, and run the below-mentioned query.
SELECT name, physical_name AS file_location
FROM sys.master_files
The result of the query is shown below.
In this article, we have shown you two methods to locate SQL Server database data files and Log file locations. One way is to simply right-click on the database and check the properties, and in another method, we run a SQL query to return the file location for all the databases.
In this article, we will show you two ways to check whether […]
It is quite easy to check backup size in SQL Server. You […]
There are many ways to check if the indexes exist in the […]
Consumer non-durables are used up or consumed relatively quickly and do not […]
The installation of SQL Server management studio 2016 (SSMS) has been changed […]
Many people around the world are facing this issue, when they sign […]