Using Python MSSQL-CLI in SQL Server

Hello to everyone,

In this article, I will try to give information about using Python MSSQL-CLI in SQL Server.

First, let me talk about what MSSQL-CLI is.

MSSQL-CLI is an interactive command line query tool for SQL Server. It is open source and built with Python. It can be used easily on MSDOS. It has autocomplete feature on MSDOS.

You don’t need to know Python to do the operations. It is important that you download and install the 3.10.

If you have done the Python installation, it’s time to install MSSQL-CLI.

Let’s go to the site below.

Using Python MSSQL CLI in SQL Server

Copy the part in the red area, paste it into MSDOS and press ENTER. You will see a process similar to the one below.

Using Python MSSQL CLI in SQL Server

The yellow warning is a warning that our Pip version is out of date. If you wish, you can update our version of Pip as indicated by the warning.

The installation process is complete. Now it’s time to use it.

mssql-cli -S YAVUZSELIM\YAVUZSELIM -d Northwind -U sa -P WriteyourownPassword


Press ENTER after typing the command. You will see the result below.

YAVUZSELIM\YAVUZSELIM is my SQL Server login INSTANCE NAME name. Northwind database name. sa user login name. Finally, you will revise your sa password above according to yourself.

Using Python MSSQL CLI in SQL Server

Now let’s write our query.

Using Python MSSQL CLI in SQL Server

I typed the query and pressed ENTER. If the result is too much, you can see the rest by pressing the SPACE button. I also added a gif image related to its usage below. You can review.

Using Python MSSQL CLI in SQL Server

As you can see, we have successfully run our query using Python MSSQL-CLI.

Good luck to everyone in business and life.


Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!