开发者

How to figure out all the instances on sql server?

开发者 https://www.devze.com 2023-01-13 17:41 出处:网络
I am connected to one instance of the database server. How will i come t开发者_如何学JAVAo know if there are any other instances on the same server and their names?First go to Start >> Run >> CMD (Ope

I am connected to one instance of the database server. How will i come t开发者_如何学JAVAo know if there are any other instances on the same server and their names?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号