Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 DROP query

Author  Topic 

david_reinjal
Starting Member

36 Posts

Posted - 2006-06-16 : 02:22:42
hi guys,
i have a code which has views and tables. i am trying to drop the table but i am geting an error. the code is:

DROP TABLE dbo.sp

and the error that i am getting is:

Cannot drop the table 'sp', because it does not exist or you do not have permission.

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2006-06-16 : 02:29:56
quote:
Originally posted by david_reinjal
DROP TABLE dbo.sp



This is the MOST interesting name for a TABLE I have ever seen in my whole career ;-) I think the DB itself is confused whether it is a SP or a table!

Do the following,
1. Try to do the same with Query analyzer.
2. Use the proper DB.
3. Syntax is correct, you may not have drop permission.



------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-16 : 02:31:07
Make sure if it exists in the database
What does this return?

Select top 1 * from dbo.sp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

CSK
Constraint Violating Yak Guru

489 Posts

Posted - 2006-06-16 : 02:36:00
Use The Object Browser And Choose ur db and Find out ur table (sp) if it's availabe in dbo or any other owner then drop it
into like



if Exists (Select 'x' from owner.sysobjects Where type ='u'
Begin
Drop table Owner.sp
End

And One more suggession:
use the proper naming cnvension
Go to Top of Page
   

- Advertisement -