Skip to content

Commit 06417e8

Browse files
committed
Avoid using non documented stored procedure sp_msforeachtable
1 parent 33b4e23 commit 06417e8

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
@@ -489,12 +489,12 @@ def check_constraints(self, table_names=None):
489489

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

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

499499

500500
class CursorWrapper(object):

0 commit comments

Comments
 (0)