Hemal
Hemal

Reputation: 124

MSSQL ReCreate LDF file for database

By mistake LDF file of my database is deleted. Now i am not able to access that database.

Is there a way which i can access this database ?

Upvotes: 0

Views: 5836

Answers (1)

Ranjana Ghimire
Ranjana Ghimire

Reputation: 1815

1) Detach corrupted database 2) Attach database using:

CREATE DATABASE [MYDATABASE] ON
( FILENAME = N’D:\Microsoft SQL Server\YourDataPath\Data\Database.mdf’ )
FOR ATTACH_REBUILD_LOG
GO

3) The log file will be created by itself

Upvotes: 2

Related Questions