Difference between revisions of "DB/MsSQL"
< DB
Jump to navigation
Jump to search
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= [https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-ver15 Install sqlcmd and bcp the SQL Server command-line tools on Linux] = | |||
<source lang=bash> | |||
# 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 -? | |||
</source> | |||
= Operational commands = | |||
Show current session process ID. In Azure Data Studio, each query window has a different SessionProcessID | Show current session process ID. In Azure Data Studio, each query window has a different SessionProcessID | ||
<source lang=sql> | <source lang=sql> | ||
Line 7: | Line 22: | ||
Due to architecture you cannot use <code>USE</code> statement. | Due to architecture you cannot use <code>USE</code> statement. | ||
References: | |||
= References = | |||
*[https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15 Download and install Azure Data Studio] | |||
*[https://docs.microsoft.com/en-us/sql/t-sql/language-elements/use-transact-sql?view=sql-server-2017 USE (Transact-SQL)] | *[https://docs.microsoft.com/en-us/sql/t-sql/language-elements/use-transact-sql?view=sql-server-2017 USE (Transact-SQL)] | ||
*[https://social.msdn.microsoft.com/Forums/azure/en-US/1d83c593-095d-416b-b927-7a6489503131/sql-quotusequot-statement-is-not-supported-in-azure-sql-database-for-selecting-different?forum=ssdsgetstarted Use of USE in Azure SQL] StackOverflow | *[https://social.msdn.microsoft.com/Forums/azure/en-US/1d83c593-095d-416b-b927-7a6489503131/sql-quotusequot-statement-is-not-supported-in-azure-sql-database-for-selecting-different?forum=ssdsgetstarted Use of USE in Azure SQL] StackOverflow | ||
[[Category:sql]][[Category:mssql]] | [[Category:sql]][[Category:mssql]] |
Latest revision as of 17:44, 11 March 2022
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.