Hello!
I trust the following helps. I did a quick check on my test instance, and it seems to work fine.
First, Let's create a test database:
USE [master]
GO
/****** Object: Database [TestDB] Script Date: 05/06/2011 16:45:13 ******/
CREATE DATABASE [TestDB] ON PRIMARY
( NAME = N'TestDB', FILENAME = N'E:\SQL Databases\SQLDefault\TestDB.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'TestDB_log', FILENAME = N'E:\SQL Databases\SQLDefault\TestDB_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
I detach the database and then go ahead and delete the log file from the particular location. I can then use the CREATE DATABASE statement with the FOR ATTACHREBUILDLOG parameter to regenerate the log file. Please note that doing so will break your log chain.
USE [master]
GO
/****** Object: Database [TestDB] Script Date: 05/06/2011 16:45:13 ******/
CREATE DATABASE [TestDB] ON PRIMARY
( NAME = N'TestDB', FILENAME = N'E:\SQL Databases\SQLDefault\TestDB.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
FOR ATTACH_REBUILD_LOG
GO
Do let me know if it helped you in your scenario or not.
commented on May 6 2011 6:21AM