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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Drop Table

Author  Topic 

siva.meti
Starting Member

32 Posts

Posted - 2007-10-24 : 03:09:15
Hi
How can i drop tables start's with 'bcd'

can u plz help me

Thx& Regards


Meti BEST OF THE BEST

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-24 : 03:19:55
SELECT 'DROP TABLE ' + table_name FROM information_schema.tables
where table_name like 'bcd%'

then copy and paste the result to a query window and run the statements.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

siva.meti
Starting Member

32 Posts

Posted - 2007-10-24 : 05:10:06
Yes I had Tried it but it will not droped

can u any body give some another solutions
plz

Meti BEST OF THE BEST
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-24 : 05:31:23
"but it will not droped"

What error are you getting?

You might want to try

SELECT 'PRINT ''' + TABLE_NAME + '''' + CHAR(13) + CHAR(10) + 'GO' + CHAR(13) + CHAR(10)
+ 'DROP TABLE ' + TABLE_NAME + CHAR(13) + CHAR(10) + 'GO'
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'bcd%'

which will drop each table that it can

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-24 : 06:03:03
quote:
Originally posted by siva.meti

Yes I had Tried it but it will not droped

can u any body give some another solutions
plz

Meti BEST OF THE BEST


I hope you are testing this on TEST server

Madhivanan

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

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-24 : 22:16:04
What kind of table are they? Did you get any error message?
Go to Top of Page
   

- Advertisement -