Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 在Python中删除索引时出错_Sql Server_Python 3.x_Pymysql - Fatal编程技术网

Sql server 在Python中删除索引时出错

Sql server 在Python中删除索引时出错,sql-server,python-3.x,pymysql,Sql Server,Python 3.x,Pymysql,我有这些pymmsql索引错误,我在代码中创建了3个索引,我想删除它们,但它们不会删除,我得到了这些错误 代码: 错误: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__ retur

我有这些pymmsql索引错误,我在代码中创建了3个索引,我想删除它们,但它们不会删除,我得到了这些错误 代码:

错误:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Python37-32\SqlVersionpr_import.py", line 840, in proceed
Micros ON payrolldata;""")
File "src\pymssql.pyx", line 465, in pymssql.Cursor.execute
pymssql.ProgrammingError: (102, b"Incorrect syntax near 'Micros'.DB-Lib error message 20018, severity 
15:\nGeneral SQL Server error: Check messages from the SQL Server\n")

正确的语法应该是正确的

DROP INDEX IF EXISTS IndexName;
DROP INDEX IndexName;
方括号表示参数或语句的一部分是可选的。 见文件


您的代码使用
Micros
作为数据库名和索引名是非常可疑的。从句法上讲,你的第二句话简直是疯了。我建议您首先使用SSM编写tsql语句,并让它们正常工作。然后将代码迁移到应用程序中。
DROP INDEX IF EXISTS IndexName;
DROP INDEX IndexName;