I need to clear the log file of database in SQL server
here is the code snippet
engine.execute(" DBCC SHRINKFILE (TEMP2_log, 1) ")
When I run the query in SQL Server , the database log file is reduced.
when I run the above code I got error like this
sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot perform a shrinkfile operation inside a user transaction. Terminate the transaction and reissue the statement. (8920) (SQLExecDirectW)')
[SQL: DBCC SHRINKFILE (TEMP2_log, 1) ]
can anyone help me where am I going wrong