[Python] Python Code to Delete All Rows of Data in SQL Server Table

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm scripting in a Python environment. I have successfully written a pandas dataframe to a table in SQL Server.

    I want to use Python code to delete all rows in my MSSQL table. I know the SQL syntax to do this (shown below).

    DELETE FROM [LON].[dbo].[MREPORT]


    But how do I incorporate the SQL syntax in my python code so I can run the code in my python environment and have it delete all rows in the SQL Server table?

    Continue reading...

Compartilhe esta Página