如何确定已安装的 SQL Server 实例及其版本?

问题描述:

我正在尝试确定我安装了哪些 sql server/sql express 实例(手动或以编程方式),但所有示例都告诉我运行 SQL 查询以确定这一点,假设我已经连接到一个特定的实例.

I'm trying to determine what instances of sql server/sql express I have installed (either manually or programmatically) but all of the examples are telling me to run a SQL query to determine this which assumes I'm already connected to a particular instance.

在命令行:

SQLCMD -L

OSQL -L

(注意:必须是大写的L)

(Note: must be a capital L)

这将列出您网络上安装的所有 sql 服务器.您可以设置一些配置选项来防止 SQL Server 显示在列表中.要做到这一点...

This will list all the sql servers installed on your network. There are configuration options you can set to prevent a SQL Server from showing in the list. To do this...

在命令行:

svrnetcn

在启用的协议列表中,选择TCP/IP",然后单击属性.有一个隐藏服务器"复选框.

In the enabled protocols list, select 'TCP/IP', then click properties. There is a check box for 'Hide server'.