Skip to content

Commit 5f902b7

Browse files
authored
README updates for v1 (#334)
1 parent 7e65011 commit 5f902b7

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

README.md

+37-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SQLCMD CLI - Preview
1+
# SQLCMD CLI
22

33
This repo contains the `sqlcmd` command line tool and go packages for working with Microsoft SQL Server, Azure SQL Database, and Azure Synapse.
44

@@ -8,13 +8,22 @@ This repo contains the `sqlcmd` command line tool and go packages for working wi
88

99
### Windows
1010

11-
`sqlcmd` is available via [Winget][], and as a downloadable .msi or .zip from the [releases page][]. The .msi installer is signed with a Microsoft Authenticode certificate.
11+
`sqlcmd` is available via [Winget][], [Choco][] and as a downloadable .msi or .zip from the [releases page][]. The .msi installer is signed with a Microsoft Authenticode certificate.
1212

1313
#### WinGet
1414

15+
| Install: | Upgrade: |
16+
| ----------------------- |-----------------------------|
17+
| `winget install sqlcmd` | `winget uninstall sqlcmd`** |
18+
| | `winget install sqlcmd` |
19+
20+
** temporary workaround, while we fix `winget upgrade`
21+
22+
#### Choco
23+
1524
| Install: | Upgrade: |
16-
| ----------------------- | ----------------------- |
17-
| `winget install sqlcmd` | `winget upgrade sqlcmd` |
25+
| ----------------------- |-------------------------|
26+
| `choco install sqlcmd` | `choco upgrade sqlcmd` |
1827

1928
### macOS
2029

@@ -88,14 +97,14 @@ sqlcmd delete
8897

8998
### Backwards compatibility with ODBC sqlcmd
9099

91-
To connect to the current context, and use the original ODBC sqlcmd flags (e.g. -q, -Q, -i, -o etc.), that can be listed with `sqlcmd -?`, run:
100+
To connect to the current context, and use the original ODBC sqlcmd flags (e.g. -q, -Q, -i, -o etc.), which can be listed with `sqlcmd -?`, run:
92101

93102
```
94103
sqlcmd -q "SELECT @@version"
95104
sqlcmd
96105
```
97106

98-
If no current context exists, `sqlcmd` (with no connection parameters) reverts to the original ODBC `sqlcmd` behavior of connecting to the default local instance on port 1433 using trusted authentication.
107+
If no current context exists, `sqlcmd` (with no connection parameters) reverts to the original ODBC `sqlcmd` behavior of creating an interactive session to the default local instance on port 1433 using trusted authentication, otherwise it will create an interactive session to the current context.
99108

100109
## Sqlcmd
101110

@@ -123,10 +132,20 @@ The following switches have different behavior in this version of `sqlcmd` compa
123132
- All commands must fit on one line, even `EXIT`. Interactive mode will not check for open parentheses or quotes for commands and prompt for successive lines. The ODBC sqlcmd allows the query run by `EXIT(query)` to span multiple lines.
124133
- `-i` now requires multiple arguments for the switch to be separated by `,`.
125134

135+
### Switches not available in the new sqlcmd (go-sqlcmd) yet
136+
137+
There are a few switches yet to be implemented in the new `sqlcmd` (go-sqlcmd) compared
138+
to the original ODBC based `sqlcmd`, discussion [#293](https://github.com/microsoft/go-sqlcmd/discussions/292)
139+
lists these switches. Please provide feedback in the discussion on which
140+
switches are most important to you to have implemented next in the new sqlcmd.
141+
142+
Also, the XML Output command `:XML [On]|[Off]` is not implemented yet
143+
in the new sqlcmd (go-sqlcmd).
144+
126145
### Miscellaneous enhancements
127146

128147
- Console output coloring (see below)
129-
- `:Connect` now has an optional `-G` parameter to select one of the authentication methods for Azure SQL Database - `SqlAuthentication`, `ActiveDirectoryDefault`, `ActiveDirectoryIntegrated`, `ActiveDirectoryServicePrincipal`, `ActiveDirectoryManagedIdentity`, `ActiveDirectoryPassword`. If `-G` is not provided, either Integrated security or SQL Authentication will be used, dependent on the presence of a `-U` user name parameter.
148+
- `:Connect` now has an optional `-G` parameter to select one of the authentication methods for Azure SQL Database - `SqlAuthentication`, `ActiveDirectoryDefault`, `ActiveDirectoryIntegrated`, `ActiveDirectoryServicePrincipal`, `ActiveDirectoryManagedIdentity`, `ActiveDirectoryPassword`. If `-G` is not provided, either Integrated security or SQL Authentication will be used, dependent on the presence of a `-U` username parameter.
130149
- The new `--driver-logging-level` command line parameter allows you to see traces from the `go-mssqldb` client driver. Use `64` to see all traces.
131150
- Sqlcmd can now print results using a vertical format. Use the new `-F vertical` command line option to set it. It's also controlled by the `SQLCMDFORMAT` scripting variable.
132151

@@ -158,7 +177,7 @@ net_transport Named pipe
158177

159178
To use AAD auth, you can use one of two command line switches:
160179

161-
`-G` is (mostly) compatible with its usage in the prior version of sqlcmd. If a user name and password are provided, it will authenticate using AAD Password authentication. If a user name is provided it will use AAD Interactive authentication which may display a web browser. If no user name or password is provided, it will use a DefaultAzureCredential which attempts to authenticate through a variety of mechanisms.
180+
`-G` is (mostly) compatible with its usage in the prior version of sqlcmd. If a username and password are provided, it will authenticate using AAD Password authentication. If a username is provided it will use AAD Interactive authentication which may display a web browser. If no username or password is provided, it will use a DefaultAzureCredential which attempts to authenticate through a variety of mechanisms.
162181

163182
`--authentication-method=` can be used to specify one of the following authentication types.
164183

@@ -178,8 +197,8 @@ This method is currently not implemented and will fall back to `ActiveDirectoryD
178197

179198
`ActiveDirectoryPassword`
180199

181-
This method will authenticate using a user name and password. It will not work if MFA is required.
182-
You provide the user name and password using the usual command line switches or SQLCMD environment variables.
200+
This method will authenticate using a username and password. It will not work if MFA is required.
201+
You provide the username and password using the usual command line switches or SQLCMD environment variables.
183202
Set `AZURE_TENANT_ID` environment variable to the tenant id of the server if not using the default tenant of the user.
184203

185204
`ActiveDirectoryInteractive`
@@ -188,11 +207,11 @@ This method will launch a web browser to authenticate the user.
188207

189208
`ActiveDirectoryManagedIdentity`
190209

191-
Use this method when running sqlcmd on an Azure VM that has either a system-assigned or user-assigned managed identity. If using a user-assigned managed identity, set the user name to the ID of the managed identity. If using a system-assigned identity, leave user name empty.
210+
Use this method when running sqlcmd on an Azure VM that has either a system-assigned or user-assigned managed identity. If using a user-assigned managed identity, set the username to the ID of the managed identity. If using a system-assigned identity, leave username empty.
192211

193212
`ActiveDirectoryServicePrincipal`
194213

195-
This method authenticates the provided user name as a service principal id and the password as the client secret for the service principal. Provide a user name in the form `<service principal id>@<tenant id>`. Set `SQLCMDPASSWORD` variable to the client secret. If using a certificate instead of a client secret, set `AZURE_CLIENT_CERTIFICATE_PATH` environment variable to the path of the certificate file.
214+
This method authenticates the provided username as a service principal id and the password as the client secret for the service principal. Provide a username in the form `<service principal id>@<tenant id>`. Set `SQLCMDPASSWORD` variable to the client secret. If using a certificate instead of a client secret, set `AZURE_CLIENT_CERTIFICATE_PATH` environment variable to the path of the certificate file.
196215

197216
#### Environment variables for AAD auth
198217

@@ -251,11 +270,13 @@ docker run -rm -e SQLCMDSERVER=<yourserver> -e SQLCMDUSER=<youruser> -e SQLCMDPA
251270
```
252271

253272
## Localization
254-
A partial localization suppport exists in go-sqlcmd for following languages for user visible content that also existed in ODBC based SQLCMD.
273+
The new sqlcmd (go-sqlcmd) is localized for the following languages:
255274
Chinese (Simplified) | Chinese (Traditional) | English (United States) | French | German | Italian | Japanese | Korean | Portuguese (Brazil) | Russian | Spanish
256275

257-
To get localized messages from SQLCMD user needs to set environment variable SQLCMD_LANG to a language tag as per BCP47 convention.
258-
E.g.
276+
Currently, the user visible strings that also existed in ODBC based sqlcmd are localized in the new sqlcmd, new strings (introduced with the new sqlcmd functionality) will be localized shortly.
277+
278+
To get localized messages from `sqlcmd` set environment variable SQLCMD_LANG to a language tag as per BCP47 convention.
279+
e.g.
259280
```
260281
\git\go-sqlcmd>set SQLCMD_LANG=de-de
261282
\git\go-sqlcmd>.\sqlcmd.exe -w 4
@@ -287,6 +308,7 @@ Any use of third-party trademarks or logos are subject to those third-party's po
287308
[Homebrew]: https://formulae.brew.sh/formula/sqlcmd
288309
[Linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux
289310
[Winget]: https://github.com/microsoft/winget-pkgs/tree/master/manifests/m/Microsoft/Sqlcmd
311+
[Choco]: https://community.chocolatey.org/packages/sqlcmd
290312
[Docker]: https://www.docker.com/products/docker-desktop/
291313
[Podman]: https://podman-desktop.io/downloads/
292314
[releases page]: https://github.com/microsoft/go-sqlcmd/releases/latest

0 commit comments

Comments
 (0)