Creating Database When MDF is Compressed

In this article, we learn how to create a database when the error “The file MDF is compressed but does not reside in a read-only database or filegroup. The file must be decompressed” occurs.

I was trying to create a database using two methods. The first is by using a command and the second is by using a wizard. When I tried to create a database I got the following error.

Using command:

create database PramodTest


Using the wizard:



Note: Please change the respective path depending on your SQL Server datafile.

Go to the following path: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL


Right-click on the DATA folder and select properties.


You will find another dialog box.


Click on the Advanced button and you will get the following screen.




Uncheck “Compress contents to save disk space” and click on OK.

After making those changes I ran the following code and it ran successfully.


I hope this article is helpful for you.

Thanks 🙂

Tags: , , ,