Create Database

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    Pretty easy if you had to attach the AdventureWorks MDF files multiple times 😀

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • kapfundestanley

    SSCertifiable

    Points: 5630

    A simple one for me thank you very much.

    “When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris

  • EL Jerry

    SSCertifiable

    Points: 7053

    Thanks for the question.

    I agree that both options may be correct, depending if the database was shut down cleanly AND only one log file existed for the database file. BOL specifies:

    - "If multiple log files exist, they must all be available."

    and

    - "If a read/write database has a single log file that is currently unavailable, and if the database was shut down with no users or open transactions before the attach operation, FOR ATTACH automatically rebuilds the log file and updates the primary file."

    in the FOR_ATTACH option.

    "El" Jerry.

    "El" Jerry.

    "A watt of Ottawa" - Gerardo Galvan

    To better understand your help request, please follow these best practices.[/url]

  • TomThomson

    SSC Guru

    Points: 104773

    Like those who commented earlier, I think both options work (provided there was a clean shutdown). I picked the second because although I knew the first optioopn would also work I guessed that the question's author didn't.

    Tom

  • nerosdk71

    Valued Member

    Points: 74

    Why don't you remove a question or clarify it when it is clearly wrong and both answers are working.

    I have tested it on my SQL Server and the "wrong" option works fine.

    Soren

  • Neha05

    Default port

    Points: 1494

    Got it right.

  • kapil_kk

    SSC-Insane

    Points: 21316

    +1 🙂

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • manik_anu

    SSCrazy

    Points: 2367

    nice question.... new thing is added in my knowledge

    manik

    *******

    Manik
    You cannot get to the top by sitting on your bottom.

Viewing 8 posts - 16 through 23 (of 23 total)

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