Monday, January 28, 2013

[mssql] mdf is Compressed But Does not Reside in a Read-only Database or Filegroup. The File Must be Decompressed

Last night I loaded a massive ASP.NET 2.0 project I did some years ago in VB.NET. It used a SQL 2000 database for data storage, so I had to attach the mdf file to get it to work. So I opened SQL Server Management Studio, opened a connection to the server instance, and went for the Attach database option.

When I selected the file, the following error came up:

“Store.mdf is Compressed But Does not Reside in a Read-only Database or Filegroup. The File Must be Decompressed.”

So here’s a quick tip for anyone who faces a similar issue. It took a few seconds to understand the problem but then I remembered file compression options. Opened my mdf file properties dialog box, and in the advance tab the problem was revealed: the “compress content” checkbox was checked.

After unchecking and saving changes, SQL Server accepted the attach with no problem whatsoever.