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.
| Author |
Topic |
|
RealSQL2005
Starting Member
3 Posts |
Posted - 2009-04-23 : 09:29:57
|
I need to figure out a way to delete almost 5,000 tables that have the characters "001" in their name........as opposed to manually selecting each table; right-click; delete; OK...etc...5,000 times!!!! Thanks.. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-23 : 09:58:01
|
Execute this codeSELECT 'DROP TABLE ' + QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLESWHERE TABLE_NAME LIKE '%[_][a-z]001[_]%'Then copy the result to a new query window and execute the pasted code. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
RealSQL2005
Starting Member
3 Posts |
Posted - 2009-04-23 : 10:53:06
|
Hey PESO!!You are the SQL-MAN!!I try to live by this creed...."....a smart man learns from his mistakes.........but a GENIUS learns from others..."Thank You SIR! |
 |
|
|
RealSQL2005
Starting Member
3 Posts |
Posted - 2009-04-23 : 11:14:08
|
| Hey Peso,So far I have deleted almost 80GB of data from my D/B, if I check on the file size, it still shows the original file size of 206GB??? |
 |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-23 : 11:15:57
|
| Try shrinking the DB. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-04-23 : 11:37:00
|
| Shrinking can cause some problems.Have you taken a full backup recently? the logs won't get truncated until you do. Which files are large?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|