connect to mdf file of localDB

  • Potentially dumb question.  There is 1 x ldf & 1 x mdf for DB1.   LocalDB.  How do I connect to these?  I am unfamiliar with localDB.

    If I run [sqllocaldb.exe i] - there are 2 other instances but not those using the log & data files I want to look at.

    Is there a way to "start" a localDB instance using this log & data file?

    Thank you!

     

     

  • Yes.  You simply need to "Attach" the database using those two files and it can be done using the Object Explorer window in SSMS.  Right click on "Databases" and then select "Attach" from the drop down that appears.  Follow your nose after that.  If you want to see the code for what's being done (as a start... you really need to read up on the command) then, before you click "OK", click on the "Script" pull down at the top of the "Attach Databases" window that you end up working in.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Duh, of course.  Thanks Jeff!  Appreciate you taking the time to reply.  I work alone and every now and again, just get stuck on something and it REALLY helps to have a shove in the right direction.

     

    Have a nice day.

     

    🙂

  • Heh... no problem.  We've all had similar problems.  Even after more than 2 decades of this stuff, I still have my "WTF? Oh, DUH!" moments especially since, like you, I mostly work alone.

    Shifiting gears a bit, I'm "Lovin' the lockdown" because I usually do work better alone (one of my favorite shirts says "Old men aren't hard of hearing... we're tired of listening!).  If we ever get back to working in the office, I'm going to wear a shirt that says "Ok.. pandemic is over but I still want some of you to stay away from me". 😀

    Anyway, thank you for the feedback... it's let's me know that I'm not the only one in the world with such moments. 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden wrote:

    Heh... no problem.  We've all had similar problems.  Even after more than 2 decades of this stuff, I still have my "WTF? Oh, DUH!" moments especially since, like you, I mostly work alone.

    Shifiting gears a bit, I'm "Lovin' the lockdown" because I usually do work better alone (one of my favorite shirts says "Old men aren't hard of hearing... we're tired of listening!).  If we ever get back to working in the office, I'm going to wear a shirt that says "Ok.. pandemic is over but I still want some of you to stay away from me". 😀

    Anyway, thank you for the feedback... it's let's me know that I'm not the only one in the world with such moments. 😀

    I'm with you on that. Fortunately, during my last rare office visit I was delighted to see they're using my desk to store stuff, man thats a really good sign for the possibility of our remote work policy continuing for the time being.

     

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

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