I have both AdventureWorks and AdventureWorks2008R2 available for the SQL Server 2008R2 instance. Now I want to have the AdventureWorks sample database available as well in my SQL Server 2012 instance. But when I tried to attach the AdventureWorks sample database, the AdventureWorks_Data.mdf file in the SQL Server 2008R2 data folder is not available to be selected for SQL Server 2012.
Solution:
If you want the original AdventureWorks sample database for the SQL Server 2008R2 instance is not affected, and also available to the SQL Server 2012 instance, try the solution below:
1. copy the AdventureWorks_Data.mdf file to the data file folder for your SQL Server 2012 instance (or somewhere else). After that, the file is available to attach, or
2. Run the code below as an admin in the query window:
CREATE DATABASE AdventureWorks
ON
(FILENAME
= 'D:Program
Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\DATA\AdventureWorks_Data.mdf')FOR ATTACH_REBUILD_LOG;