|
| 1 | +# AdventureWorks2014 Sample Databases for SQL Server |
| 2 | + |
| 3 | +AdventureWorks2014 is a sample database for SQL Server. It works with SQL Server 2014 and later versions. |
| 4 | + |
| 5 | +**Latest release**: [AdventureWorks2014 release](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2014) |
| 6 | + |
| 7 | +**Feedback on the sample **: send to [[email protected]](mailto:[email protected]) |
| 8 | + |
| 9 | +### Contents |
| 10 | + |
| 11 | +[About this sample](#about-this-sample)<br/> |
| 12 | +[Before you begin](#before-you-begin)<br/> |
| 13 | +[Disclaimers](#disclaimers)<br/> |
| 14 | +[Related links](#related-links)<br/> |
| 15 | + |
| 16 | + |
| 17 | +<a name=about-this-sample></a> |
| 18 | + |
| 19 | +## About this sample |
| 20 | + |
| 21 | +<!-- Delete the ones that don't apply --> |
| 22 | +1. **Applies to:** SQL Server 2014 (or higher) |
| 23 | +1. **Key features:** Core database features |
| 24 | +1. **Workload:** OLTP |
| 25 | +1. **Programming Language:** T-SQL, C# |
| 26 | +1. **Update history:** |
| 27 | + 31 July 2017 - Initial migration from Codeplex |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +<a name=before-you-begin></a> |
| 32 | + |
| 33 | +## Before you being |
| 34 | + |
| 35 | +To run this sample, you need the following prerequisites: |
| 36 | + |
| 37 | +### Software prerequisites |
| 38 | + |
| 39 | +1. SQL Server 2014 (or later) |
| 40 | +2. [SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms) |
| 41 | + |
| 42 | + |
| 43 | +<a name=run-this-sample></a> |
| 44 | + |
| 45 | +## Install AdventureWorks2014 database from a backup |
| 46 | + |
| 47 | +The Adventure Works 2014 OLTP database can be installed by restoring a database backup. |
| 48 | + |
| 49 | +1. Download the Adventure Works 2014 Full Database Backup.zip. |
| 50 | +2. From File Download, click Save. Once it is saved, open the folder. |
| 51 | +3. Extract the AdventureWorks2014.bak file to a location on your local server. Note: The default 64-bit path is C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup. Use C:\Program Files (x86)\... for 32-bit SQL Server 2014. |
| 52 | +4. From SQL Server Management Studio connect to the 2014 instance. |
| 53 | +5. On the Standard toolbar, click the New Query button. |
| 54 | +6. Execute the following code in the query window: |
| 55 | +Note: The file paths in the scripts are the default paths. You may need to update the paths in the scripts to match your environment. |
| 56 | + |
| 57 | +```sql |
| 58 | +USE [master] |
| 59 | + |
| 60 | +RESTORE DATABASE AdventureWorks2014 |
| 61 | +FROM disk= 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\AdventureWorks2014.bak' |
| 62 | +WITH |
| 63 | +MOVE 'AdventureWorks2014_data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorks2014.mdf', |
| 64 | +MOVE 'AdventureWorks2014_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorks2014.ldf' |
| 65 | +,REPLACE |
| 66 | +``` |
| 67 | +As an alternative to steps 5 and 6, you can restore the database using the SQL Server Management Studio user interface. For more detailed information, see Restore a Database Backup (SQL Server Management Studio) . |
| 68 | + |
| 69 | +## Install AdventureWorksDW2014 from a database backup |
| 70 | + |
| 71 | +To install AdventureWorksDW2014 from a database backup: |
| 72 | + |
| 73 | +1. Download [adventure-works-2014-full-database-backup.zip](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2014). |
| 74 | +2. Extract the AdventureWorks2014.bak file to a location on your local server. Note: The default 64-bit path is C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup. Use C:\Program Files (x86)\... for 32-bit SQL Server 2014. |
| 75 | +3. From SQL Server Management Studio connect to the 2014 instance. |
| 76 | +4. On the Standard toolbar, click the New Query button. |
| 77 | +5. Execute the following code in the query window: Note: The file paths in the scripts are the default paths. You may need to update the paths in the scripts to match your environment. |
| 78 | + |
| 79 | +```sql |
| 80 | +USE [master] |
| 81 | + |
| 82 | +RESTORE DATABASE AdventureWorksDW2014 |
| 83 | +FROM disk= 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\AdventureWorksDW2014.bak' |
| 84 | +WITH MOVE 'AdventureWorksDW2014_data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2014.mdf', |
| 85 | +MOVE 'AdventureWorksDW2014_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2014.ldf' |
| 86 | +,REPLACE |
| 87 | +``` |
| 88 | + |
| 89 | +As an alternative to steps 5 and 6, you can restore the database SQL Server Management Studio user interface. For more detailed information, see [Restore a Database Backup using SSMS](https://docs.microsoft.com/sql/relational-databases/backup-restore/restore-a-database-backup-using-ssms). |
| 90 | + |
| 91 | + |
| 92 | +<a name=disclaimers></a> |
| 93 | + |
| 94 | +## Disclaimers |
| 95 | +The code included in this sample is not intended to be used for production purposes. |
| 96 | + |
| 97 | +<a name=related-links></a> |
| 98 | + |
| 99 | +## Related Links |
| 100 | +<!-- Links to more articles. Remember to delete "en-us" from the link path. --> |
| 101 | +For more information, see these articles: |
| 102 | +- [SQL Server 2014 product page](https://msdn.microsoft.com/library/dn197878(v=sql.10).aspx) |
| 103 | +- [SQL Documentation](https://docs.microsoft.com/en-us/sql/#pivot=main&panel=databases) |
0 commit comments