Skip to content

Commit a8ceb4e

Browse files
authored
Merge pull request #28 from BobDenar1212/dev
Avoid using non documented stored procedure sp_msforeachtable
2 parents ff59848 + 06417e8 commit a8ceb4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mssql/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,12 @@ def check_constraints(self, table_names=None):
490490

491491
def disable_constraint_checking(self):
492492
if not self.needs_rollback:
493-
self.cursor().execute('EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT ALL"')
493+
self._execute_foreach('ALTER TABLE %s NOCHECK CONSTRAINT ALL')
494494
return not self.needs_rollback
495495

496496
def enable_constraint_checking(self):
497497
if not self.needs_rollback:
498-
self.cursor().execute('EXEC sp_msforeachtable "ALTER TABLE ? WITH NOCHECK CHECK CONSTRAINT ALL"')
498+
self._execute_foreach('ALTER TABLE %s WITH NOCHECK CHECK CONSTRAINT ALL')
499499

500500

501501
class CursorWrapper(object):

0 commit comments

Comments
 (0)