August 28, 2009 at 11:18 pm
When I try to drop the index using TSQL as follows:
drop index TestIndex on Empdetails.Empid
The error is:
Msg 3701, Level 11, State 6, Line 1
Cannot drop the index 'Empdetails.Empid.TestIndex', because it does not exist or you do not have permission.
But I can do this from SSMS:
What can be the reason? Any headsup!!
-LK
August 29, 2009 at 1:42 am
Is the table called Empdetails? If it is then the syntax is drop indexTestIndex on Empdetails
With the syntax you are using, SQL is looking for a table called EmpId in the schema Empdetails. You also get this error if you are in the wrong database
You can get the correct syntax by going to management studio, right-clicking on the index and select Script Drop Index
August 31, 2009 at 4:19 am
Thanks DNA
August 31, 2009 at 4:24 am
You can also get the correct syntax by reading Books Online, the SQL help file. It really is very good.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 31, 2009 at 5:46 am
"...But I can do this from SSMS:..."
Most SSMS functions can be scripted out to a query window without actually being run. Then you can see the syntax that SQL will generate and learn from it, modify it etc...
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply