Hi @CSource ,
Welcome to Microsoft Q&A!
You are using Python scripts with SQL Server, you can use a true Python editor, like VS Code, and not rely on using SSMS. If your indents are incorrect, you will see an error message similar to this:
Msg 39004, Level 16, State 20, Line 0
A 'Python' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 0
An external script error occurred:
The error is clear: "unexpected indent." The error message also points to the exact spot. But you could have many such errors in future. That's why using VS Code would be handy, and you can then cut and paste the script into your procedure.
Best regards,
Seeya
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.