https://learn.microsoft.com/zh-cn/sql/tools/configuration-manager/named-pipes-properties?view=sql-server-ver16
https://learn.microsoft.com/zh-cn/sql/tools/configuration-manager/client-protocols-named-pipes-properties-protocol-tab?view=sql-server-ver16
默认情况下, SQL Server 侦听:\.\pipe\sql\query(对于默认实例)和 \.\pipe\MSSQL$\sql\query(对于命名实例)
Unless changed by the user, when the default instance of Microsoft SQL Server listens on the named pipes protocol, it uses \.\pipe\sql\query as the pipe name. The period indicates that the computer is the local computer, pipe indicates that the connection is a named pipe, and sql\query is the name of the pipe. To connect to the default pipe, the alias must have \<computer_name>\pipe\sql\query as the pipe name. If SQL Server has been configured to listen on a different pipe, the pipe name must use that pipe. For instance, if SQL Server is using \.\pipe\unit\app as the pipe, the alias must use \<computer_name>\pipe\unit\app as the pipe name.
At the time of connection, the SQL Server Native Client component reads the server, protocol, and pipe name values from the registry for the specified alias name, and creates a pipe name in the format np:\<computer_name>\pipe<pipename> or np:\\pipe<pipename>. For a named instance, the default pipe name is \<computer_name>\pipe\MSSQL$<instance_name>\sql\query.
SSMS如何以Named pipe方式连接sqlserver,直接在SSMS的Servername一栏填上np:servername
SELECT session_id, net_transport,auth_scheme,client_net_address,client_tcp_port,local_net_address,local_tcp_port FROM sys.dm_exec_connections
session_id net_transport auth_scheme client_net_address client_tcp_port local_net_address local_tcp_port
54 TCP KERBEROS 172.22.136.35 55293 172.22.136.187 1433
58 Named pipe KERBEROS <named pipe> NULL NULL NULL
63 Session NTLM <local machine> NULL NULL NULL
64 Shared memory NTLM <local machine> NULL NULL NULL
--net_transport值为TCP的表示是TCP连接,值为Named pipe的表示是Named pipe连接,值为Shared memory的一般是在数据库本地的连接类似mysql的socket连接且auth_scheme一般是NTLM