Monday, 14 May 2012

SQL Server – AdventureWorks for SQL Server 2012

I have just started learning about SQL Server 2012 RTM and realised that I haven’t installed AdventureWorks sample database. I have quickly searched online and reached to Microsoft Database Products Samples where it provides information about all sample databases and procedure to install databases for SQL Server 2012. See below to install (restore) database:
  1. Download AdventureWorks from here
  2. Run below script
CREATE DATABASE AdventureWorks2012
ON (FILENAME = 'D:\SQL\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG ;

You will see below message and you are DONE after running above script!


File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Log.ldf" may be incorrect.


New log file 'D:\SQL\AdventureWorks2012_log.ldf' was created.


Converting database 'AdventureWorks2012' from version 705 to the current version 706.


Database 'AdventureWorks2012' running the upgrade step from version 705 to version 706.



AttachDatbasewithoutlog