New Database creation

  • Hello All,

    I have a task on hand for every 15 days. I will be receiving an .mdf file only and have to create the respective database on my local server. The steps followed by me are as follows:

    1. Created a database as exactly as the mdf file available to me.

    2. Detached the database created, and moved the mdf file of this database to another location.

    3. Now copied the mdf file available to me to the present database location.

    4. Tried to attach the database.

    but getting error -- that the mdf file is not the same and can't be attached.

    Waiting for help.

    Ravi


    Lucky

  • Why so complicated? Can't you just attach the mdf file directly. SQLServer will automatically create a new ldf.

    M

    [font="Verdana"]Markus Bohse[/font]

  • MarkusB is right. Just remember to attach using sp_attach_single_file_db to accomplish without an LDF. Also, make sure the version is compatible 7 or 2000 for 2000 but only 7 with 7 and 6.x with 6.x. And make sure ldf from previous attempts are deleted.

  • Hello Markus & Antares

    Thanks for the reply.

    If i receive an .mdf file, i can directly attach the database by providing this mdf file as per your guidance, so that the .ldf file will be generated automatically.

    Secondly, if i receive an mdf file with different name which belongs to the same database at my end, how this should be treated.

    1. should i take the database offline and then copy the received .mdf file?

    2. rename the .mdf file to the one which is existing at my end in order to bring the database back online.

    expecting guidance.

    Ravi


    Lucky

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

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