Problem attaching database to re-install of SQLExpress 2014

  • I have been running SQL 2014 Express for quite some time, I built a database with it and have used it in a pet project of mine in Visual Basic 2015. Recently I started my computer and attempted to run the program and received an error that said it couldn't find the SQL Server.

    I ran SQL Server Management Studio and found that it also wouldn't connect to the Server. In running the diagnostics the results stated that my SQL Server Express file was corrupt and the bast recommendation was to un-install and re-install it. I did this, but now I can't reattach the database to the new installation.

    Now, when I run SQL Server Management Studio it does connect to the Server, but when I attempt to attach the database I get this error:

    "Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'D:\Data Files 092015\DVD_List.mdf'. (Microsoft SQL Server, Error: 5123)"

    Its not like it's a newer version of the Server so what is the problem here?

    It ain't over 'til it's over - Yogi Berra

  • Quick question, is the new install running under the same credentials as the old one? Looks like a simple permission issue.

    😎

  • First try run Management Studio as admin (right click shortcut, run as administrator)

    If that doesn't work, then you need to grant the service account which SQL Express is running under full control to the folder with the data and log files.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Darndest thing, the next morning I turned on the computer and without thinking started the movie program and it ran without a hitch. I then went into SSMS and connected to the database again, without a hitch. Can't figure it out, but 'If it ain't broke, don't attempt to fix it" Thanks for the replies.

    darby

    It ain't over 'til it's over - Yogi Berra

  • Blame Windows.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

Viewing 5 posts - 1 through 5 (of 5 total)

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