none
How do I install AdventureWorks2012 OLTP database from script?

    Question

  • I just installed SQL Server 2012.  But I cannot install this database either from script or from MDF file.  When I try to install it from script, I get the error:

    Loading [Person].[Address]
    Msg 4861, Level 16, State 1, Line 4
    Cannot bulk load because the file "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\Tools\Samples\AdventureWorks 2012 OLTP Script\Address.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).
    ** An error was encountered during execution of batch. Exiting.

    I commented this table out, but then I got errors on the tables after this.  Only part of this database was installed.  I checked and I do not see a Tools\Samples directory anywhere on my computer! 

    Next, I dropped this database and then I tried

    CREATE DATABASE AdventureWorks2012 ON (FILENAME = '{drive}:\{file path}\AdventureWorks2012_Data.mdf') FOR ATTACH_REBUILD_LOG;

    But this gave me an error:

    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 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\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.

    How can I install this database?  And yes, I followed the instructions here:

    http://social.technet.microsoft.com/wiki/contents/articles/3735.sql-server-samples-readme.aspx#Readme_for_Adventure_Works_Sample_Databases


    Ryan D


    • Edited by ironryan77 Saturday, July 06, 2013 5:25 AM
    Saturday, July 06, 2013 3:11 AM

Answers

All replies