Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Use of sp_MSforeachtable on Azure SQL Database #12

Closed
meet-bhagdev opened this issue Sep 23, 2015 · 1 comment
Closed

Use of sp_MSforeachtable on Azure SQL Database #12

meet-bhagdev opened this issue Sep 23, 2015 · 1 comment

Comments

@meet-bhagdev
Copy link

Hi Aymeric,
Hope you are doing well. I am working on a Django app that uses django-pymssql. It works great on SQL Server, however if I try to run the same app with my Azure SQL Database it fails.

It is because the stored proc - sp_MSforeachtable is not supported on Azure SQL Database.

Here is my error message when I run python manage.py migrate:

File "/Library/Python/2.7/site-packages/sqlserver_ado/base.py", line 292, in disable_constraint_checking
cursor.execute('EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"')
File "pymssql.pyx", line 462, in pymssql.Cursor.execute (pymssql.c:6514)
pymssql.ProgrammingError: (2812, "Could not find stored procedure 'sp_MSforeachtable'.DB-Lib error message 20018, severity 16:\nGeneral SQL Server error: Check messages from the SQL Server\n")

What would be your recommendation in getting migrations to work for Azure SQL Database the same as SQL Server. As of now, my work around is using SSMS to create the stored proc so that django-pymssql can use it. However, for a pure linux/mac environment that will be difficult.

Please let me know.

Thanks,
Meet

@aaugustin
Copy link
Owner

Hi Meet,

The stack trace shows that the code initiating the call to this stored procedure is in sqlserver_ado/base.py, a module provided by django-mssql:

Obviously the same problem happens with plain django-mssql on Windows, without django-pymssql.

I suggest to head over to the django-mssql repository to have this discussion with its maintainer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants