I've got a large SQL script (1gb) that I'm trying to run against a (localdb)\v11.0
instance, using SqlCmd
in a command line window, but so far no commands I've tried have worked with it at all.
E.g.
sqlcmd.exe -S "(localdb)\v11.0" -Q "select 1"
fails with a generic connection error:
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.
However
sqlcmd.exe -S "MY-PC" -Q "select 1"
is fine with the SQL Server instance on my PC.
"Allow Remote Connections" is set to true on the (localdb)
instance and the user I'm running the sqlcmd
with is the owner of it.
Does Sqlcmd
actually work with (localdb)
instances? Are there any other obvious things I might be doing wrong?
I believe this can happen when you use the wrong version of SQLCMD for the LocalDB instance as described in this post...
Why can't I connect to a SQL Server 2012 LocalDB shared instance?
Hth, Ojf