DB/MsSQL

From Ever changing code
< DB
Revision as of 16:44, 11 March 2022 by Pio2pio (talk | contribs) (Pio2pio moved page MsSQL to DB/MsSQL without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Install sqlcmd and bcp the SQL Server command-line tools on Linux

# Import the public repository GPG keys.
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Ubuntu repository.
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
# Update the sources list and run the installation command with the unixODBC developer package.
sudo apt-get update 
sudo apt-get install mssql-tools unixodbc-dev
# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
/opt/mssql-tools/bin/sqlcmd -?


Operational commands

Show current session process ID. In Azure Data Studio, each query window has a different SessionProcessID

SELECT @@SPID

Azure MsSQL

Due to architecture you cannot use USE statement.


References