Monday, March 12, 2012

help needed to drop a table!!!

hi,

can any one tell me how to drop a table...i tried to delete using the command :

drop table sample;

but it displays an error stating that,

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

pls post the reply asap

-Sweety

To verify that the table does indeed exists, try:

SET ROWCOUNT 1
SELECT * FROM MyTable
SET ROWCOUNT 0

Then if you receive data, and the statement DROP TABLE MyTable again fails, check your permissions. It is possible that your login does not have permission to remove a table.

|||

Make sure you're using the correct db.

USE MyTest
GO
DROP TABLE Test

Adamus

|||

check whether the table exists in the db at all... if exists , see who owns it.... give fully qualified name.

in SQL 2005

select Name from Sys.Objects where name='tablename'

Drop table databasename.schema.Tablename

SQL 2000

select Name from SysObjects where name='tablename'

Drop Table databasename.owner.Tablename

Madhu

|||

May be that table actually does not exist

|||

sweet_salt wrote:

hi,

can any one tell me how to drop a table...i tried to delete using the command :

drop table sample;

but it displays an error stating that,

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

pls post the reply asap

-Sweety

Check that the account that you are using to run this query has the appropriate permission to do so.

Check the user properties in the security node.

No comments:

Post a Comment