Подія
31 бер., 23 - 2 квіт., 23
Найбільший навчальний захід SQL, Fabric і Power BI. 31 березня – 2 квітня. Щоб заощадити 400 грн, скористайтеся кодом FABINSIDER.
Реєструйтеся сьогодніЦей браузер більше не підтримується.
Замініть його на Microsoft Edge, щоб користуватися перевагами найновіших функцій, оновлень безпеки та технічної підтримки.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
SQL database in Microsoft Fabric
This article describes how to connect to the SQL Server database engine by using the sqlcmd utility.
SQL Server supports client communication with the TCP/IP network protocol (the default), and the named pipes protocol. The shared memory protocol is also available if the client is connecting to an instance of the Database Engine on the same computer. There are three common methods of selecting the protocol. The protocol used by the sqlcmd utility is determined in the following order:
sqlcmd uses the protocol specified as part of the connection string, as described later in this article.
If no protocol is specified as part the connection string, sqlcmd uses the protocol defined as part of the alias that's connected. To configure sqlcmd to use a specific network protocol by creating an alias, see Create or delete a server alias for use by a client.
If the protocol isn't specified in some other way, sqlcmd uses the network protocol determined by the protocol order in SQL Server Configuration Manager.
The following examples show various ways of connecting to the default instance of Database Engine on port 1433, and named instances of Database Engine presumed to be listening on port 1691. Some of these examples use the IP address of the loopback adapter (127.0.0.1). Test using the IP address of your computer network interface card.
Connect to the Database Engine by specifying the instance name:
sqlcmd -S ComputerA
sqlcmd -S ComputerA\instanceB
Connect to the Database Engine by specifying the IP address:
sqlcmd -S 127.0.0.1
sqlcmd -S 127.0.0.1\instanceB
Connect to the Database Engine by specifying the TCP\IP port number:
sqlcmd -S ComputerA,1433
sqlcmd -S ComputerA,1691
sqlcmd -S 127.0.0.1,1433
sqlcmd -S 127.0.0.1,1691
Connect using the following general syntax:
sqlcmd -S tcp:<computer name>,<port number>
Connect to the default instance:
sqlcmd -S tcp:ComputerA,1433
sqlcmd -S tcp:127.0.0.1,1433
Connect to a named instance:
sqlcmd -S tcp:ComputerA,1691
sqlcmd -S tcp:127.0.0.1,1691
Connect using one of the following general syntaxes:
sqlcmd -S np:\\<computer name>\<pipe name>
Connect to the default instance:
sqlcmd -S np:\\ComputerA\pipe\sql\query
sqlcmd -S np:\\127.0.0.1\pipe\sql\query
Connect to a named instance:
sqlcmd -S np:\\ComputerA\pipe\MSSQL$<instancename>\sql\query
sqlcmd -S np:\\127.0.0.1\pipe\MSSQL$<instancename>\sql\query
Connect using one of the following general syntaxes:
sqlcmd -S lpc:<computer name>
Connect to the default instance:
sqlcmd -S lpc:ComputerA
Connect to a named instance:
sqlcmd -S lpc:ComputerA\<instancename>
Подія
31 бер., 23 - 2 квіт., 23
Найбільший навчальний захід SQL, Fabric і Power BI. 31 березня – 2 квітня. Щоб заощадити 400 грн, скористайтеся кодом FABINSIDER.
Реєструйтеся сьогодніНавчання
Модуль
Дізнайтеся, як безпечно підключити sql-сервер Azure за допомогою приватної кінцевої точки Azure за допомогою порталу Azure, забезпечуючи приватний і безпечний зв'язок із сервером SQL Server.
Сертифікація
Microsoft Certified: Azure Database Administrator Associate - Certifications
Адмініструйте інфраструктуру баз даних SQL Server для хмарних, локальних і гібридних реляційних баз даних за допомогою пропозицій реляційних баз даних Microsoft PaaS.