December 7, 2007 at 3:58 am
in a sqlserver database 2005 suppose we dnt have or we lost an ldf file then how to create an ldf file i.e. log file from an existing .mdf file .
December 7, 2007 at 4:25 am
Use Attach Database method. BTW, You cannot have mdf or ldf files in CE edition. There are actually sdf files.
--Ramesh
December 7, 2007 at 4:26 am
Try attach option of the mdf file and it should prompt for creation of new ldf file on verify. Never tried though.
Thanks
Prasad Bhogadi
www.inforaise.com
December 7, 2007 at 5:00 am
Look for the stored procedure "sp_attach_single_file_db" in SQL Server Books Online (the SQL manual - not actually "online" on the net).
December 7, 2007 at 5:26 am
You could also use the newer version for attaching database (as sp_attach_single_file_db is deprecated in SQL Server 2005)
CREATE DATABASE SomeDB
ON (FILENAME = 'c:\data\SomeDB.mdf')
FOR ATTACH
--Ramesh
December 7, 2007 at 6:03 am
Ooops, an additional quote!!!!
Edited my previous post:
--Ramesh
December 7, 2007 at 6:31 am
megha.chauhan (12/7/2007)
CREATE DATABASE nwdata (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL\Dataewldf.mdf')FOR ATTACHthis is the query bt its not executing. can u trace out why?
thank you
You missed the ON clause....
CREATE DATABASE nwdata ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL\Dataewldf.mdf') FOR ATTACH
--Ramesh
December 7, 2007 at 6:43 am
I am sounding bit stupid bt that was nt the error I wrote that correctly still it wasn't working it gives the error as
Device activation error. The physical file name 'C:\Program Files\Microsoft SQL Server\MSSQL\Dataewldf_DATA.mdf' may be incorrect.
bt file name is correct
December 7, 2007 at 6:50 am
Do you have the directory path as is given above. Just to test try from Start Menu --> Run --> C:\Program Files\Microsoft SQL Server\MSSQL\
and see if this folder is accessible. It may sound elementarybut just wondering...
Thanks
Prasad Bhogadi
www.inforaise.com
Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy