Although multiple instances of Microsoft® SQL Server™ 2000 can run on a single computer, there is no direct connection between instances. Each instance operates in many ways as if it is on a separate server. An application connected to one instance cannot access objects in databases created in another instance, except through distributed queries. Databases and database files cannot be shared between instances.
Named instances of SQL Server 2000 database engines have almost the same behaviors as default instances. The main difference is that you must supply both the computer name and instance name to identify a named instance. When you specify only computername, you work with the default instance. When you specify computername\instancename you work with the named instance.
When you specify only computername in Service Manager, you can stop and start the default instance. When you specify computername\instancename you can stop and start the named instance. When a specific instance is started, any database created in that instance is available to any application that connects to the instance using an authorization ID that has permissions to access the database.
Using SQL Server Enterprise Manager you can register each instance for which you have permissions. After an instance is registered, you can create, edit, and drop objects in the databases associated with that instance, subject to the permissions granted to you. You can also create, edit, and drop Data Transformation Services, Replication, and SQL Server Agent objects for that instance.
In an application, when you specify computername as the server name parameter in a connection request, you are connected to the default instance on the computer. You can access any databases in the default instance that you have permissions to access. If you specify computername\instancename as the server name parameter, you are connected to the named instance. You can access any databases in that named instance that you have permissions to access. When you are connected to a specific instance, objects in databases in other instances can be accessed only through distributed queries, just as objects in databases on other servers can be accessed only through distributed queries. Applications specify the instance name in different ways:
Distributed queries and linked server definitions use computername\instancename to identify named instances and computername to identify default instances. For more information, see Distributed Queries on Multiple Instances of SQL Server.
When you use the command prompt utilities, you can use the Server switch to specify an instance by using computername\instancename, for example:
osql -E -Scomputer1\instance1
sqlservr /Sinstance1
The isql utility does not support named instances.
Applications using SQL Server 2000 client components can enumerate the instances available for connections:
Performance Monitor counters, Profiler events, and Windows events in the Event Viewer Application Log all identify the instance of SQL Server with which they are associated.
The string returned by the @@SERVERNAME function identifies the name of the instance in the form servername\instancename if you are connected to a named instance. If connected to a default instance @@SERVERNAME returns only servername. For more information, see @@SERVERNAME.
The SERVERPROPERTY function INSTANCENAME property reports the instance name of the instance to which you are connected. INSTANCENAME returns NULL if connected to a default instance. In addition, the SERVERNAME property returns the same format string returned by @@SERVERNAME and will have the format servername\instancename when connected to a named instance. For more information, see SERVERPROPERTY.
Although the strings reported by @@SERVERNAME and SERVERNAME use the same format, the information they report can be different, for example: