tags:

views:

33

answers:

2

I have SQL 2005 Express installed. I then installed SQL Server 2008 R2 and am running both instances successfully. They are named:

  • COMPUTERNAME\SQLEXPRESS (2005)
  • COMPUTERNAME\INSTALL2 (2008)

I am trying to figure out how to specify the 2008 instance as the default server. I have tried:

  • Data Source=.\local; ...
  • Data Source=.; ...
  • Data Source=localhost; ...
  • Data Source=(local); ...
  • Data Source=127.0.0.1; ...

Each time there is a connection error stating...

Test connection failed because of an error in initializing provider. A 
network-related or instance-specific error occurred while establishing a 
connection to SQL Server. The server was not found or was not accessible. Verify 
that the instance name is correct and that SQL Server is configured to allow 
remote connections. (provider: Named Pipes Provider, error: 40 - Could not open 
a connection to SQL Server)

I have other developers who are working on the same project and only have SQL Server 2008 R2 installed and they are able to use Data Source=(local); ... to connect without any issues.

Is there a way for me to define my 2008 instance as the default or local instance?

A: 

If you didn't choose "default instance" when you installed SQL Server, there's no way to change it after the fact without an uninstall/reinstall. You'll need to fully specify the instance name in your connection string.

Data Source=COMPUTERNAME\INSTALL2;
Joe Stefanelli
Right. I know that I can connect to mine using COMPUTERNAME\INSTALL2 but was hoping to find a way to define the default instance without reinstalling. This way we can share the same config files for the project.
Chris
+1  A: 

You can use a Connection Alias. See How to: Create a Server Alias for Use by a Client

Remus Rusanu
This worked great, thanks.
Chris