Skip to content

Commit 0b90a00

Browse files
authored
Update usage_guide.md
1 parent 4bd566f commit 0b90a00

File tree

1 file changed

+36
-55
lines changed

1 file changed

+36
-55
lines changed

doc/usage_guide.md

Lines changed: 36 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# Usage Guide
2-
Contents:
3-
4-
[Description](#Description)
5-
6-
[Options](#options)
7-
8-
[Examples](#examples)
9-
10-
[Environment Variables](#environment-variables)
2+
Contents
3+
* [Description](#description)
4+
* [Options](#options)
5+
* [Examples](#examples)
6+
* [Environment Variables](#environment-variables)
117

128
## Description
139
mssql-cli is a new and interactive command line query tool for SQL Server. This open source tool works cross-platform and is a proud member of the dbcli community.
@@ -29,7 +25,7 @@ Usage: main.py [OPTIONS]
2925

3026
Options:
3127
-S, --server TEXT SQL Server instance name or address.
32-
-U, --username TEXT Username to connect to the postgres database.
28+
-U, --username TEXT Username to connect to the database.
3329
-W, --password Force password prompt.
3430
-E, --integrated Use integrated authentication on windows.
3531
-v, --version Version of mssql-cli.
@@ -46,52 +42,42 @@ Options:
4642
## Examples
4743
Below are example commands that run against the AdventureWorks database in a localhost server instance. Here is a list of examples:
4844
49-
[Connect to a server](#Connect-to-a-server)
50-
51-
[Exit mssql-cli](#Exit-mssql-cli)
52-
53-
[Navigate multiple pages of query result](#Navigate-multiple-pages-of-query-result)
54-
55-
[Quit a query](#Quit-a-query)
56-
57-
[Clear screen](#Clear-screen)
58-
59-
[Toggle multi-line mode](#Toggle-multi-line-mode)
60-
61-
62-
63-
### <a id="Connect-to-a-server"></a>Connect to a server
45+
* [Connect to a server](#connect-to-a-server)
46+
* [Exit mssql-cli](#exit-mssql-cli)
47+
* [Navigate multiple pages of query result](#navigate-multiple-pages-of-query-result)
48+
* [Quit a query](#quit-a-query)
49+
* [Clear screen](#clear-screen)
50+
* [Toggle multi-line mode](#toggle-multi-line-mode)
6451
52+
### Connect to a server
6553
Connect to a server, a specific database, and with a username. -S -d and -U are optional. You can [set environment variables](#Environment-Variables) to set default settings.
6654
6755
```bash
6856
mssql-cli -S localhost -d AdventureWorks -U sa
6957
```
7058
71-
### <a id="Exit-mssql-cli"></a> Exit mssql-cli
72-
59+
### Exit mssql-cli
7360
Press **Ctrl+D** or type:
74-
7561
```bash
7662
quit
7763
```
7864
79-
### <a id="Navigate-multiple-pages-of-query-result"></a>Navigate multiple pages of query result
65+
### Navigate multiple pages of query result
8066
If you select a table that has many rows, it may display the results in multiple pages.
8167
8268
- Press **Enter** key to see one row at a time.
8369
- Press **Space bar** to see one page at a time.
8470
- Press **q** to escape from the result view.
8571
86-
### <a id="Quit-a-query"></a>Quit a query
72+
### Quit a query
8773
If you are in the middle of writing a query and would like to cancel it, press **Ctrl+C**
8874
89-
### <a id="Clear-screen"></a>Clear screen
75+
### Clear screen
9076
If you want to clear the Terminal view, press **Ctrl+K**
9177
9278
If you want to clear in Command Prompt, press **Ctrl+L**
9379
94-
### <a id="Toggle-multi-line-mode"></a>Toggle multi-line mode
80+
### Toggle multi-line mode
9581
To enable multi-line mode, press **F3 key**. You can see at bottom of screen if Multiline is on or off.
9682
9783
To use multi-line mode, follow these instruction:
@@ -125,55 +111,50 @@ SELECT "Name", "DepartmentID"
125111
126112
## Environment Variables
127113
Below are a list of environment variables that can be set.
114+
* MSSQL_CLI_SERVER - [Set default server](#set-default-server)
115+
* MSSQL_CLI_DATABASE - [Set default database](#set-default-database)
116+
* MSSQL_CLI_USER - [Set default user](#set-default-user)
117+
* MSSQL_CLI_PASSWORD - [Set default password](#set-default-password)
118+
* MSSQL_CLI_ROW_LIMIT - [Set default row limit](#set-default-row-limit)
128119
129120
**Important: If you are using macOS or Linux, use 'export' instead of 'set'. 'set' is Windows-only.**
130121
131-
[Set default server](#Set-default-server)
132-
133-
[Set default user](#Set-default-user)
134-
135-
[Set default password](#Set-default-password)
136-
137-
[Set default database](#Set-default-database)
138-
139-
[Set default row limit](#Set-default-row-limit)
140-
141-
### <a id="Set-default-server"></a>Set default server
122+
### Set default server
142123
Set environment variable MSSQL_CLI_SERVER to set a default SQL Server instance name or address
143124
144125
```bash
145126
set MSSQL_CLI_SERVER=localhost
146127
mssql-cli
147128
```
148129
149-
###<a id="Set-default-user"></a> Set default user
130+
### Set default database
131+
Set environment variable MSSQL_CLI_DATABASE to set a default database.
132+
133+
```bash
134+
set MSSQL_CLI_DATABASE=AdventureWorks
135+
mssql-cli -S localhost -U sa
136+
```
137+
138+
### Set default user
150139
Set environment variable MSSQL_CLI_USER to set a default user.
151140
152141
```bash
153142
set MSSQL_CLI_USER=sa
154143
mssql-cli -S localhost -d AdventureWorks
155144
```
156145
157-
###<a id="Set-default-password"></a> Set default password
146+
### Set default password
158147
Set environment variable MSSQL_CLI_PASSWORD to set a default password.
159148
160149
```bash
161150
set MSSQL_CLI_PASSWORD=abc123
162151
mssql-cli -S localhost -d AdventureWorks -U sa
163152
```
164153
165-
###<a id="Set-default-database"></a> Set default database
166-
Set environment variable MSSQL_CLI_DATABASE to set a default database.
167-
168-
```bash
169-
set MSSQL_CLI_DATABASE=AdventureWorks
170-
mssql-cli -S localhost -U sa
171-
```
172-
173-
###<a id="Set-default-row-limit"></a> Set default row limit
154+
### Set default row limit
174155
Set environment variable MSSQL_CLI_ROW_LIMIT to set threshold for row limit prompt. Use 0 to disable prompt.
175156
176157
```bash
177158
set MSSQL_CLI_ROW_LIMIT=10
178159
mssql-cli -S localhost -U sa
179-
```
160+
```

0 commit comments

Comments
 (0)