Questions tagged [sql-server-localdb]

SQL Server localdb is an edition of SQL Server Express without server installation. Application developers can use it to distribute a database with their applications without requiring the user to install a SQL Server engine

SQL Server Express LocalDB, introduced in SQL Server 2012, is a light-weight version of SQL Server Express that replaces User Instances, which were introduced in SQL Server 2005. LocalDB (as it is commonly referred to) instances are created per each user, and the instance and their databases are installed into a user's local profile directory. By default these instance are private, but they can be shared with other users on the same server.

LocalDB runs as a background process for each user that starts their own private instance rather than as a service that is shared by all users and would have its own security context. Connectivity is only through Named Pipes; external connectivity is not available. However, specifying the correct named pipe to connect to can be problematic due to the instance name changing each time it starts (i.e. instance name = LOCALDB#{8_character_alphanumeric_id}, named pipe = np:\.\pipe\LOCALDB#{8_character_alphanumeric_id}\tsql\query).

Fortunately, a new special syntax for the Server Name was added to use in connection strings. You can specify (localdb)\InstanceName in SSMS, SQLCMD, and via the SqlConnection class in .NET applications (though be aware that this was not available until .NET Framework version 4.0.2). This syntax provides two benefits:

  1. It allows for using a consistent server name in your code
  2. It will automatically start the LocalDB instance if it is not already running.

LocalDB can be started, stopped, and otherwise managed via the SQLLocalDB.exe utility. Additionally, LocalDB will be automatically started when using the (LocalDB)\InstanceName connection string syntax, and it will automatically stop about 5 minutes after the last connection closes.

For more info, please see:

47 questions
40
votes
4 answers

LocalDB v14 creates wrong path for mdf files

Recently, I upgraded LocalDB from version 13 to 14 using the SQL Server Express installer and this instruction. After the installation, I stopped the existing default instance (MSSQLLOCALDB) of version 13 and created a new one, which automatically…
feO2x
  • 503
  • 1
  • 4
  • 6
18
votes
10 answers

Cannot start SqlLocalDB instance with my Windows account

I'm the administrator and simply run the command: sqllocaldb start v11.0 Result: Start of LocalDB instance "v11.0" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process failed to sta …
Nime Cloud
  • 351
  • 1
  • 2
  • 8
18
votes
3 answers

Where to download SQL Server 2019 Express LocalDB Installer MSI from

SQL Server 2019 is released but I there doesn't appear to be a LocalDB version available for download. Does anyone know if there will be a LocalDB release or if 2017 is the last version?
Simon
  • 283
  • 1
  • 2
  • 6
18
votes
1 answer

Connect to LocalDB via SQLCMD in PowerShell

I'm trying to access the "localdb\MSSQLLocalDB" server on my computer through PowerShell with the SQLCMD utility. I'm using PowerShell v5, .NET v5.0, and the server name is (localdb)\MSSQLLocalDB when I connect to it in Microsoft SQL Server…
jmk22
  • 305
  • 1
  • 3
  • 6
13
votes
1 answer

Move folder of SQL Server LocalDB instances from the default location

I get multiple errors with LocalDB (startup error, can't create DB from SQL Server Management Studio and also multiple issues when trying to restore a backup) and none of the fixes I found are helping anything. It seems to me that all errors have…
Piedone
  • 233
  • 1
  • 2
  • 6
10
votes
3 answers

Should developers be allowed to use LocalDB vs a "development" instance?

Much like the vein of the question that was posted here previously around "Should developers be able to query production databases?" I wanted to get your thoughts on another particularly annoying topic! Many companies prevent developers from install…
10
votes
1 answer

How do I connect to localDB from SQL Server 2014 Express

I downloaded both the LocalDB and Management Studio for MS SQL Server 2014 Express so that I can practice on my local machine. However, when I open Management Studio and try to browse to localDB to connect to start created databases I can't locate…
9
votes
1 answer

Error starting localDb on Windows 11

I installed Windows 11 on a brand new NUC, then installed all updates. Installed Visual Studio 2022 CE and SSMS (v 18.10) I attempted to start the localDB which is assume was installed as part of Visual Studio 2022/ SSMS and when…
Computer
  • 193
  • 1
  • 1
  • 3
8
votes
4 answers

Does LocalDB support temporary tables?

Are SQL Server temporary tables (prefixed with #) supported in LocalDB instances?
7
votes
1 answer

What is the migration/deployment path from a LocalDB solution to Enterprise instance?

Given the extant definition for SQL Server 2012's LocalDB as SqlLocalDB is a local, low-overhead database engine of SQL Server 2012 (and future versions) that allows developers to focus on development rather than instance configuration or…
swasheck
  • 10,755
  • 5
  • 48
  • 89
7
votes
3 answers

Can't connect to SQL Server 2017 Local DB shared instance

I cannot connect to a SQL Server 2017 (14.0.1000.169) Local DB shared instance. I tried on a laptop that previously had some SQL Server Express and stuff that I all have uninstalled. And also on a fresh Win10 VM. Both always have the same…
Leojet
  • 73
  • 1
  • 5
6
votes
2 answers

Access SQL Server Express LocalDB from Local Area Network

I am developing a software which requires SQL Server. But for a 50MB application it is not a good idea to tell customers to install SQL Server. So I think it's better to use SQL Server Express LocalDB. I want to give feature of accessing my app from…
IT researcher
  • 3,168
  • 15
  • 59
  • 82
5
votes
2 answers

Where is SQLCMD.EXE in SQL Server 2014 LocalDB or how to install it?

On a machine with SQL Server LocalDB 2014 installed I am looking for SQLCMD.EXE file but cannot find it anywhere. Is there a way how to install it separately? Unfortunately I am not local admin of the machine, so I prefer no MSI... Found this link…
Vojtěch Dohnal
  • 629
  • 1
  • 11
  • 24
5
votes
2 answers

DROP DATABASE statement cannot be used inside a user transaction

Not really sure if this question belongs here, but I hope someone could help me out. I've made integration tests going all the way down to the database (using mssql localDB). I want each test to run independently with it's own data - I want to…
S. Peter
  • 185
  • 2
  • 5
4
votes
1 answer

Is LocalDB installed independently of SQL Server?

I am a Developer. I thought LocalDB was installed as a component of Visual Studio, which could be used for development purposes. However, it appears to be installed independently of Visual Studio. Is it installed as part of SQL Server; SQL Data…
w0051977
  • 513
  • 2
  • 9
  • 18
1
2 3 4