Reputation: 3085
I use SQL Server 2014 and I'm kind of new to SQL Server. After installing SQL Server, there is only one instance of SQL Server with my PC's user name. If I try to login in using the SQL Server name as (local)
, it won't login. But if I use the instance name it logins successfully.
The reason I want to login with this SQL Server name (local)
is because I don't want to reset the connection string in my ASP team project every time after I made a pull from that project or worse make a push to Git.
Error message:
Upvotes: 1
Views: 259
Reputation: 3085
I finally fixed the error with a clue given to me by @kstix and @Sean Lang, I installed a new instance as a default (MSSQLSERVER). Now I can log in using the server name (local).
But for best practice like @RBarryYoung suggested make the connection string configuration external check out this link for how to:D
Sql Connection Strings in .Config Files vs. Source Control
Upvotes: 2
Reputation: 2244
SQL Server 2005 Default and Named Instances
An instance is either the default, unnamed instance, or it is a named instance. When SQL Server 2005 is in installed in the default instance, it does not require a client to specify the name of the instance to make a connection. The client only has to know the server name.
A named instance is identified by the network name of the computer plus the instance name that you specify during installation. The client must specify both the server name and the instance name when connecting.
(local) always refers to the default instance.
Creating aliases is a corner case; not a best practice.
To connect to the default instance without calling it (local), just use the machine name.
Example:
Default MYPCNAME
Default localhost
Default 127.0.0.1
Named instance MYPCNAME\Foo
Named instance localhost\Foo
Named instance 127.0.0.1\Foo
Upvotes: 2