Attaching or creating a database in SQL Server 2005

  • I was getting following error while creating a database or attaching a database to sql server 2005

    "The file <<*.mdf>> is compressed but does not reside in a read-only database or filegroup.."

    After little bit of troubleshooting, I found this was happening because of a folder option (of the folder where database file reside (in case of attach) or being created (in case of create)).

    Go to folder properties, General Tab, click on Advanced button,check "Compress or Encrypt attributes" section. If the first option (Compress contents to save disk space) is checked, you get that error. Uncheck it to fix that problem.

  • In this scenario, you get following error if you try attaching it using sql query.

    Msg 5118, Level 16, State 1, Line 1

  • May be your disk was formatted with compression enabled.

    Check with your system admin..

    Are you able to create a database using create db script?

     

    MohammedU
    Microsoft SQL Server MVP

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply