How can I install the Northwind database into SQL Server Local DB?
sql-server
Solution
So, I can't seem to find a way of attaching an existing DB file to a LocalDB instance from inside visual studio (creating a new DB seems to be the only option), but you can do it via management studio by doing the following:
Step 1 - Find out the instance name of the LocalDB
Open a command prompt and run (the location may be slightly different depending on your install location):
C:\Program Files\Microsoft SQL Server\110\Tools\Binn>SqlLocalDB.exe info
This will list all the instances of LocalDB, find the one you're interested in, VS2012 installed one for me called v11.0 (which I will use for my example)
Step 2 - Start the LocalDB instance
Again in your command prompt run the following:
C:\Program Files\Microsoft SQL Server\110\Tools\Binn>SqlLocalDB.exe start v11.0
This will start the LocalDB instance and allow us to get the connection info
Step 3 - Get the name of the named pipe to connect to (pipe name changes every restart)
Another command prompt job:
C:\Program Files\Microsoft SQL Server\110\Tools\Binn>SqlLocalDB.exe info v11.0
This will then return information about the instance, including the following line:
Instance pipe name: np:\.\pipe\LOCALDB#A6F550C6\tsql\query
Step 4 - Connect via management studio and attach the database
Open management studio and in the server box connect to the named pipe (windows auth) e.g. :
\.\pipe\LOCALDB#A6F550C6\tsql\query
You will now be in the SQL server like it was a normal instance, you can copy your Northwind MDF file to the data directory of the instance (mine was the root of my user folder) and then in the databases node in the management studio right click and select attach, select the MDF file and then attach as normal.
Hope this helps.
Problem
I found the following link Installing the Northwind Sample Database However I am still not clear on the process. This talks about Server 2000 and MSDE 2000 but what I need is for the new SQL Server Local DB. Has anyone else had to do this and found any instructions on how to proceed?