The download for this sample database only contains a .mdf file and no LDF file (transaction log). When I try to add this database trough the SQL Management Studio I receive an error that the LDF is missing and that because of that the database can’t be added.
I did some Google research to find a way to add this database to my lab environment.
To make this possible I wrote a small TSQL script to add the database to the SQL server in my lab.
USE [master] GO EXEC sp_attach_single_file_db @dbname='AdventureWorks2012', @physname=N'C:\SQL\DATA\AdventureWorks2012_Data.mdf' GO
The transaction log is recreated and the database is added to the SQL Management Studio
Was once an enthusiastic PepperByte employee but is now working at Ivanti. His blogs are still valuable to us and we hope to you too.