Skip to content
Advertisement

Does not detach database by sp_detach_db in pyodbc

I am trying to detach the database, but for some reason it does not detach with no error, am I missing something?

JavaScript

SQLServer 2012 version: 11.0.2100

pyodbc version: 4.0.31

Advertisement

Answer

Thx for Gord Thompson for the tip.

Fixes:

  • SET SINGLE_USER WITH NO_WAIT -> SET TRUSTWORTHY ON
  • Remove from connect params “Trusted_Connection=yes;”, It associates the system user instead of “sa” user.
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement