views:

23

answers:

1

I am connected to one instance of the database server. How will i come to know if there are any other instances on the same server and their names?

+1  A: 

First go to Start >> Run >> CMD (Open command prompt). Once in command prompt run following command based on SQL Server version installed on local machine.

For SQL Server 2000:
C:\> isql -L

For SQL Server 2005 / SQL Server 2008:
C:\> osql -L
OR
C:\> sqlcmd -L

As SQL script below is the snippet - Source

This script requires execute permissions on XP_CMDShell.

CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers (sname)
EXEC master..xp_CMDShell 'ISQL -L'
DELETE
FROM #servers
WHERE sname='Servers:'
OR sname IS NULL
SELECT LTRIM(sname)
FROM #servers
DROP TABLE #servers
Sachin Shanbhag