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.

Answer from steoleary on Stack Overflow
Top answer
1 of 2
12

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.

2 of 2
1

How about just restoring via SSMS using Steps:

  1. Download northwind (https://northwinddatabase.codeplex.com/) and save .bak somewhere
  2. Open SSMS
  3. Connect to (localdb)\ProjectsV12 (or whatever version you have)
  4. Right Click Databases Node (see image)
  5. Select Restore...

  1. In Restore Database window, Source | choose 'Device' radio button and in drop down 'Backup media Type' choose File and then click 'Add' button browse to location of downloaded .bak file

  1. That's it, your .bak should be loaded to a new database on your machine.
🌐
Alpha Software
documentation.alphasoftware.com › documentation › pages › GettingStarted › GettingStartedTutorials › Basic Tutorials › Northwind › northwindSQLServer.xml
Importing the Northwind Access Database into SQL Server
Open SQL Server Management Studio. Right-click on "Databases" and select New Database... from the context menu. Create a New Database... In the Database name field, type in "northwind" and click OK
Discussions

Import Northwind Sample
Why are you doing it that way instead of just using sql express installation to learn SQL? More on reddit.com
🌐 r/SQLServer
9
3
May 10, 2021
add northwind to Azure SQL server on mac m1
What image are you using? This ? It looks like you just need to run a .sql script for Northwind. Can you connect to your SQL instance in DataGrip (I assume port 1433 is exposed, but the docs don't really mention connecting from anywhere but VS Code/Azure Data Studio so far as I can see)? If so, you should just be able to run the script against it. Unless you need to use that DB in particular I'd use WideWorldImporters . You'd probably need to use Azure Data Studio or VS Code with this extension to deploy a .bacpac (or maybe you can deploy a .bak, I dunno), but it's a newer sample database and so uses newer features. More on reddit.com
🌐 r/dataengineering
2
1
June 8, 2022
I Need the Northwind Database on SQL Server
I have SSMS and need to add Northwind to my local SQL Server instance. ... This does not seem easy to me... I just want the file db file so I can add it, using SSMS. ... We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads. ... Here is the script which will do the work for you: https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases... More on experts-exchange.com
🌐 experts-exchange.com
June 23, 2023
Northwind Database for SQL Server 2005 – SQLServerCentral Forums
I just yesterday managed to make a connection to the SQL Server with some very fine assistance by a few MS MVP's (In another Forum) but the ADO.NET 2.0, Microsoft Press, author Rebecca M. Riordan uses the Northwind and the Pubs databases in the exercises throughout the book so I need to add these ... More on sqlservercentral.com
🌐 sqlservercentral.com
September 18, 2012
🌐
ASPSnippets
aspsnippets.com › Articles › 3401 › SQL-Server-2019-Download-and-Install-Northwind-Database
SQL Server 2019: Download and Install Northwind Database
This option will open up a File Browser within SQL Server and you need to navigate and select the · NORTHWIND.MDF file and press OK button. That’s it. You will see that the database is now available in your SQL Server along with the other databases. Description is required. ... Address: ASPSNIPPETS PRIVATE LIMITED G-110, SHAGUN ARCADE, MALAD (EAST), MUMBAI, MAHARASHTRA, INDIA 400097.
Published   July 28, 2025
🌐
Whizdom Trainings
etltestingtutorial.com › etl-testing-tutorial › how-to-install-and-attach-northwind-database-in-sql
How To Install And Attach NorthWind Database in SQL
This video covers the Installation process of Northwind database as well it shows the steps, how one can attach Northwind database in SQL Platform.
Published   July 9, 2020
Views   9K
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › framework › data › adonet › sql › linq › downloading-sample-databases
Get the sample SQL Server databases for ADO.NET code samples - ADO.NET | Microsoft Learn
A number of examples and walkthroughs in the LINQ to SQL documentation use sample SQL Server databases and SQL Server Express. You can download these products free of charge from Microsoft. Download the script instnwnd.sql from the following GitHub repository to create and load the Northwind sample database for SQL Server:
🌐
Businessimpactinc
businessimpactinc.com › 2013 › 01
January 2013 – Business Impact - Data Management
Open SQL Server Management Studio and connect to your instance. Right-click the “Databases” folder and click “Attach”. Click “Add…” in the “Databases to attach:” box and find NORTHWIND.MDF in your folder. Make sure to click on the file and check that the “Database Data File ...
Find elsewhere
🌐
YouTube
youtube.com › watch
How to Install the Northwind SQL Server Sample Database - YouTube
Here's a quick video to show you how to install Microsoft's Northwind sample database in SQL Server using the SQL Server Management Studio. Northwind is my r...
Published   March 17, 2022
🌐
FoxLearn
foxlearn.com › home › sql › how to download and restore northwind database to sql server
How to Download and Restore Northwind database to SQL Server
February 28, 2025 - Then, extract the file, open the SQL script in SQL Server Management Studio, and press F5 to execute. Alternatively, you can run the following command (example): sqlcmd -S localhost -d Northwind -i D:\Sql\Northwind.sql · You can easily find the northwind database sample in the extracted folder of northwind database download sql.
🌐
Wikiversity
en.wikiversity.org › wiki › Database_Examples › Northwind › SQL_Server
Database Examples/Northwind/SQL Server - Wikiversity
-- Either: -- Open Microsoft SQL Server Management Studio. -- Connect to your server. -- Open a new query window. -- Copy and paste the SQL below into the query window. -- Execute the script to create the Northwind database. -- Or: -- Run the following command in a terminal window.
🌐
YouTube
youtube.com › ashish thakur
How To Install And Attach NorthWind Database in SQL - YouTube
For ETL Testing Trainings Videos visit: https://www.etltestingtutorial.com/etl-testing-trainingFor ETL Testing Tutorial Free Videos Visit: https://www.etltes...
Published   May 4, 2020
Views   23K
🌐
Vskills
vskills.in › home › adding the northwind database to your application
Adding the Northwind Database to Your Application - Tutorial
April 12, 2024 - Restore the Northwind database to your SQL Server instance using SQL Server Management Studio or another tool. This will create the database on the server and populate it with tables and data. In your ASP.NET application, add a connection string to your web.config file that specifies the server name, database name, and any other necessary connection parameters.
🌐
Experts Exchange
experts-exchange.com › questions › 29261557 › I-Need-the-Northwind-Database-on-SQL-Server.html
Solved: I Need the Northwind Database on SQL Server | Experts Exchange
June 23, 2023 - I have SSMS and need to add Northwind to my local SQL Server instance. ... This does not seem easy to me... I just want the file db file so I can add it, using SSMS. ... We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads. ... Here is the script which will do the work for you: https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs and here are the steps: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/linq/downloading-sample-databases
🌐
Blogger
csharp-tutorials1.blogspot.com › 2019 › 06 › install-northwind-database-in-sql.html
Install Northwind database in SQL Server 2012 - C# Tutorials
1. First download the database ... SQL Server Management Studio and connect to your instance. Right-click the “Databases” folder and click “Attach”. 3. Click “Add…” in the “Databases to attach:” box and find ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › previous-versions › aspnet › bb763181(v=vs.100)
How to: Set Up the Northwind Sample Database for ASP.NET Development | Microsoft Learn
Click the Download button and save the SQL2000SampleDb.msi file to a local folder on your computer. After the download has finished, double-click the SQL2000SampleDb.msi file to begin the installation process.
🌐
SQLServerCentral
sqlservercentral.com › home › topics › northwind database for sql server 2005
Northwind Database for SQL Server 2005 – SQLServerCentral Forums
September 18, 2012 - I printed "Northwind Database Installation" and "Installing the Northwind Sample Database", both from Microsoft webpages. I just noticed that the latter is for VS 2012 and I need to go back and click on "Other Versions" to get specific instructions on how to install to SQL Server 2005 Developer Edition.
🌐
Microsoft Community
techcommunity.microsoft.com › microsoft community hub › communities › products › sql server › sql server engine
NorthWind | Microsoft Community Hub
April 19, 2024 - I connected to the Microsoft site and downloaded the scripts to activate the pubs and NorthWind databases. pubs was activated but NorthWind was not for SqlServer2017 instnwnd.sql and instpubs.sql. In instpubs.sql there are CREATE DATABASE which generates the database, in instnwnd.sql no.
🌐
C# Corner
c-sharpcorner.com › article › how-to-restore-northwind-database-in-sql-server-in-1-minute
How To Restore Northwind Database In SQL Server In One Minute
October 11, 2023 - You can also extract it to any other location on your PC. In this tutorial, I extracted it from the “ E” drive. This makes it easy for me to remember the location. Step 2. Open SQL Server Management Studio (SSMS).