Timeline for SQL Server Halts Executions Of Large Loops When T-SQL Is Called From Python [duplicate]
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 3, 2022 at 21:12 | history | closed | David Browne - Microsoft sql-server Users with the sql-server badge or a synonym can single-handedly close sql-server questions as duplicates and reopen them as needed. | Duplicate of Having trouble calling a stored procedure in SQL Server from Python pyodbc | |
| Mar 3, 2022 at 20:54 | comment | added | Charlieface | sql_file.split(';') seems wrong, there are any number of reason why multiple statements should be in the same batch, especially if you have complex procedural code. As stated, you should really use a tally table or a numbers function, see sqlperformance.com/2021/01/t-sql-queries/… | |
| Mar 3, 2022 at 20:11 | comment | added | Thom A♦ | Add SET NOCOUNT ON; to the start of your batch. I could reproduce this (though with a different number of rows INSERTed). But, as mentioned, don't use a loop. If you want the numbers 1-500 use a Tally. | |
| Mar 3, 2022 at 20:07 | comment | added | RBarryYoung | First, I'd encourage to not use loops like this in SQL, they're rarely a good idea, and set-based SQL is usually better in almost every regard. As to why this is happening it might be something in the python libraries or a timing disconnect (though it shouldn't always be 37, if the latter). I'd recommend tracing it from SSMS while you are executing it from python. | |
| Mar 3, 2022 at 19:51 | history | asked | Bob Wakefield | CC BY-SA 4.0 |