-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsummit2020_demo_005.txt
49 lines (34 loc) · 1.65 KB
/
summit2020_demo_005.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#######################################################################################
# PASS Virtual Summit 2020 - SQL Server on Linux from A to Z (Randolph West) #
# Pre-conference session (2020-11-10) #
#######################################################################################
# The scripts in this document are procured from several sources, including Microsoft #
# Docs, Wikipedia, genuinecoder.com, linuxhint.com, howtogeek.com, linux.org, #
# ss64.com, and tecmint.com. #
# No copyright is claimed or intended from these code samples #
#######################################################################################
#######################################################################################
### Connect to SQL Server from the command line
#######################################################################################
### Tools are located in /opt/mssql-tools/bin
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '<YourPassword>'
mssql-cli -U
### Which command-line tool do you prefer?
-- list all special commands
\?
-- describe objects (calls sp_help)
\d
-- edit query in external editor
\e
-- list databases
\ld
-- list databases verbose
\ld+
-- list databases verbose with pattern
\ld+ m
#######################################################################################
### Back up and restore a SQL Server database from the command line
#######################################################################################
mssql-cli -U
-- list databases
\ld