3

In our company we have an old piece of software which was written by our previous I.T manager but was never finished.

The program connects to SQL server but we want it to point to a newer SQL server we have recently configured.

The old instance name (on the current server) is simply server1.

Our new instance name (on the new server) is server2\someinstance.

Changing the programs app.cfg file to point to server server2\someinstance isn't a problem until a certain stage where it joins to another database on the same server. The program then throws the below error:

Msg 102, Level 15, State 1, Line 2 Incorrect syntax near '\'.

If we run the same query in SSMS, we get the same error but to get around this we can put square brackets around the name and then the query completes successfully, e.g [server2\someinstance].

The problem I have is I cannot edit his source code and when attempting to change the DB server in the app.cfg to [server2\someinstance] it won't connect to the instance at all.

The only way I see around this is to reinstall SQL server on the new server, without having any slash at all, e.g server2.

I thought I'd ask the question here in case anyone can offer any other suggestions. I've looked into SQL aliases but am not sure this is what I want (plus when trying it would never connect using the alias name anyway, but that's probably a separate issue).

Thanks.

1 Answer 1

2

Create a Server Alias to point to your named instance.

In SQL Server Configuration Manager, expand SQL Server Native Client Configuration, right-click Aliases, and then click New Alias.

In the Alias Name box, type the name of the alias. Client applications use this name when they connect.

In the Server box, type the name or IP address of a server. For a named instance append the instance name.

In the Protocol box, select the protocol used for this alias. Selecting a protocol, changes the title of the optional properties box to Port No, Pipe Name, or Connection String.

If you're having trouble getting the client to connect via an alias, I'd suggest detailing the error message in a separate question.

1
  • I just get the usual "A network-related or instance-specific error occured" message. I think this is probably what I need to do though, I'm having the exact same issue as this person. Marking as correct though, as I think this is now a different issue - joy!
    – Ricky
    Commented Aug 30, 2012 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.