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
 File to drop tables

Author  Topic 

sacko_ax
Starting Member

21 Posts

Posted - 2006-12-06 : 10:34:03
I need to create a file that removes (drops) all of your database objects.

nr
SQLTeam MVY

12543 Posts

Posted - 2006-12-06 : 10:34:36
A file?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sacko_ax
Starting Member

21 Posts

Posted - 2006-12-06 : 10:35:21
A notepad (.sql) file that drops the objects
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-06 : 10:45:16
truncate table sysobjects
truncate table sysdatabases



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-12-06 : 10:57:03
My guess is that if you don't know the SQL knowledge to accomplish this, then more than likely you also don't have the authority.

Jay
to here knows when
Go to Top of Page

sacko_ax
Starting Member

21 Posts

Posted - 2006-12-06 : 10:59:33
What authority would that be, and your right i dont have the knowledge to do this, thats why I asked in the first place and posted in 'New To SQL'!!
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-06 : 11:05:07
Try Peter's solution, if you want to get kicked in your ass by your boss! (that too without backup to add to excitement).

Or more simple way:

Drop Database database-name


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-06 : 11:06:23
sp_msforeachdb 'drop database ?'
sp_msforeachdb 'drop database ''?'''


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-12-06 : 11:18:00
What are you trying to achieve?
Dropping all tables in a database that are owned by a particular user?

Do you want a script that can be loaded into query analyser (v2000?) and run or a file that can be run via osql?


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2006-12-06 : 11:25:16
But I like my database objects. Why do you want to drop my objects? Why not drop your own?
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2006-12-06 : 12:03:48
format c: /u

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-07 : 01:18:56
Ouch!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

sacko_ax
Starting Member

21 Posts

Posted - 2006-12-07 : 10:54:05
format c:/ .... That doesnt sound like the best solution ive ever heard
Go to Top of Page
   

- Advertisement -