Forum Discussion
komail_2811
Dec 08, 2023Copper Contributor
How To Attach MDF File Without Log File
Hi,
I have one MDF file without LDF file
when attach this file to sql i have this error , how to solve this problem ?
in first step :
USE master
GO
EXEC sys.sp_attach_single_file_db @dbname = 'old_mil1',
@physname = N'F:\old_mil.mdf'
GO
Error : The FOR ATTACH option requires that at least the primary file be specified.
Step 2 :
USE [master]
Go
CREATE DATABASE [Tester] ON
(FileName = N'F:\old_mil.mdf' )
For Attach
GO
Error : The FOR ATTACH option requires that at least the primary file be specified.
How to Solve This Problem , This File is Very Important for me.
- Hello
Please try below option
CREATE DATABASE [Tester]ON
(FileName = N'F:\old_mil.mdf'’)
For ATTACH_REBUILD_LOG
GO
Regards
Javier - olafhelperBronze Contributor
komail_2811 wrote:Hi,
I have one MDF file without LDF filewhen attach this file to sql i have this error , how to solve this problem ?
Error : The FOR ATTACH option requires that at least the primary file be specified.
komail_2811 , the error message is not complaining about a missing LOG file, it says the file isn't a valid primary database file.
- komail_2811Copper ContributorThanks
but How to solve this problem ?- olafhelperBronze ContributorTo solve it you have to get the right&all database files.