Results 1 to 5 of 5

Thread: Issue with .mdf file

  1. #1
    Join Date
    Sep 2015
    Posts
    3

    Post Issue with .mdf file

    I was trying to attach .mdf file with the help of SSMS but I do not have .ldf file. I click on the attach option and add the .mdf file. Now it is showing the error message to me.

  2. #2
    Join Date
    May 2015
    Posts
    19
    Are you getting Microsoft SQL Server, error – 5120?

  3. #3
    Join Date
    Sep 2015
    Posts
    3
    Yes, I am getting this eror

  4. #4
    Join Date
    May 2015
    Posts
    19
    you can solve this issue by using T-SQL :

    CREATE DATABASE [YourDatabaseName] ON
    (FILENAME = 'C:\123\YourDatabaseName.mdf')
    FOR ATTACH_REBUILD_LOG ;

    Or, you can also use a stored procedure:

    EXEC sp_attach_single_file_db @dbname=' YourDatabaseName',
    @physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQL \MSSQL\DATA\ YourDatabaseName.mdf'
    GO

    If a single log file is missing.

    Good Luck!

  5. #5
    Join Date
    Sep 2015
    Posts
    3
    Thank you so much.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •