Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am droping an index on a table but its throwing error.

Alter table cust_branch_item_stock Drop index  index;


Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index' at line 1


What I have tried:

I changed the syntax to like this

<pre>Alter table cust_branch_item_stock Drop index  index;


but still same error

is there any way to do this to execute successfully

any help world be greatfull
Posted
Updated 18-Jul-19 19:27pm
v5

1 solution

The syntax is
SQL
ALTER TABLE table_name
DROP INDEX index_name;
You have:
SQL
Alter table cust_branch_item_stock Drop index  index
is your index called index?

I would expect something more like:
SQL
Alter table `cust_branch_item_stock` Drop index `idx_<<tablename>>_<<column_name(s)>>`
 
Share this answer
 
Comments
Member 11337367 19-Jul-19 1:48am    
yes my index name is index only
Graeme_Grant 19-Jul-19 2:47am    
Index is a reserved keyword. Look at my answer more closely... use
`index`
to indicate that it is not a keyword.
Member 11337367 19-Jul-19 2:49am    
thank you
Graeme_Grant 19-Jul-19 2:59am    
you are welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900