How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?

How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
I tried using DROP Tables, Truncate Database, Delete and many more but it is not working.  I want to delete all tables using Query Analyzer, i.e. through SQL Query.
Please help me out in this concern.
Nishith Shah

Informative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
declare @TTName Table
(TableSchemaTableName
varchar
(500),
[status] int
default 0);
with AvailableTables
(TableSchemaTableName)
as
(select
QUOTENAME(TABLE_SCHEMA)
+
+
QUOTENAME(TABLE_NAME)
from
INFORMATION_SCHEMA.TABLES)
insert into @TTName
(TableSchemaTableName)
select *
from AvailableTables
declare @TableSchemaTableName varchar
(500)
declare @sqlstatement nvarchar
(1000)
while 1=1
begin
set @sqlstatement
=
'DROP TABLE '
+ @TableSchemaTableName
exec
sp_executeSQL
@sqlstatement
print
'Dropped Table : '
+ @TableSchemaTableName
update @TTName
set [status]
= 1
where TableSchemaTableName
= @TableSchemaTableName
if
(select
count([Status])
from @TTName
where [Status]
= 0)
= 0
break
end

Similar Messages

  • How can i get all the users from weblogic server?

    how can i get all the users from weblogic server?
    i have configurated a LDAP server using iPlanet and
    in weblogic server console i see those users from LDAP
    server. but how can i get all the users in my program
    from weblogic server instead of LDAP server?
    BTW,how to configure a RDBMSAuthenticator and what should i do
    in Oracle? which tables should i create? and how are their architectures?
    Thanks
    Daniel

    BTW, i use weblogic platform 8.1
    "Daniel" <[email protected]> дÈëÓʼþ
    news:[email protected]..
    how can i get all the users from weblogic server?
    i have configurated a LDAP server using iPlanet and
    in weblogic server console i see those users from LDAP
    server. but how can i get all the users in my program
    from weblogic server instead of LDAP server?
    BTW,how to configure a RDBMSAuthenticator and what should i do
    in Oracle? which tables should i create? and how are their architectures?
    Thanks
    Daniel

  • How can we find all the available  user-exits in sap without using SMOD?.

    How can we find all the available  user-exits in sap without using SMOD?.

    Hi,
    Please check this links for user exits list.
    http://www.planetsap.com/Userexit_List.htm
    http://www.easymarketplace.de/userexit.php
    http://www.sap-img.com/ab038.htm
    Regards,
    Ferry Lianto

  • Copy the data from Sql Server to edirectory using java

    Hi ,
    I am new to e directory.I don't know how it works.Can some one assist
    me on this ,I have to extract data from SQL Server and update these
    data in edirectory.This is needs to be done using java.
    If any one can provide me the sample code or please suggest how to
    proceed .
    Thanks in advance
    dukewarm
    dukewarm's Profile: http://forums.novell.com/member.php?userid=53430
    View this thread: http://forums.novell.com/showthread.php?t=373051

    dukewarm;1792481 Wrote:
    > Hi ,
    >
    > I am new to e directory.I don't know how it works.Can some one assist
    > me on this ,I have to extract data from SQL Server and update these
    > data in edirectory.This is needs to be done using java.
    >
    > If any one can provide me the sample code or please suggest how to
    > proceed .
    >
    > Thanks in advance
    Read the values from SQL server and use LDAP to update the data in
    eDirectory.
    Thomas
    thsundel
    thsundel's Profile: http://forums.novell.com/member.php?userid=128
    View this thread: http://forums.novell.com/showthread.php?t=373051

  • Migrating a table from SQL server 2005 to oracle 9i

    Hi
    I need to migrate a table from SQL server to oracle, both of which are on different machines, I tried using SQL server DTS export functionality selected the Oracle driver, created a DSN, but it gave error message box as shown below
    Error Source: Microsoft OLE DB Provider for ODBC Drivers
    "ORA 12560 :TNS protocol adapter error"
    Context:Error During initialization of the provider
    While i was successfully able to migrate the table from SQL SERVER to MS-ACCESS and from MS ACCESS to Oracle
    thanks
    abhishek

    Hi
    thanks warren, i just figured out that the DSN i had created while migrating data from Access to oracle was User DSN, i just created a system DSN of the similar kind and was successfully able to export the data from SQL server to oracle, the only problem being the column names in SQL server are longer than the limit of 30 characters we have in ORACLE..
    Regards
    Abhishek

  • How do I move all the photos from the i-photo library on one account to the i-photo library on another account?

    I have recently bought a new mac mini running Lion, and yesterday I migrated an account off an older machine running Tiger.
    I want to delete the older account from this machine as it is causing some problems with i-cloud, but I want to transfer the photos first and add them to a different account on the new computer.
    So my question is How do I move all the photos from the i-photo library on one account to the i-photo library on another account?

    Copy the iPhoto library from the old Mac to the Desktop of the new one.  Then download the paid version of  iPhoto Library Manager, which is now compatible with Mt. Lion, and use it to merge the two libraries into a new, third library.  This will preserve the two libraries in case the merged library isn't to your liking. 
    Here are screenshots of iPLM's coping and merging preferences:
    When you're satisfied that the new, merged libraray is complete and working OK you can delete the two earlier libraries.
    OT

  • How do I get all the songs from an album to show in the album view?  Currently, if an album lists the artist plus a guest artist, those are shown separately and appear to be two different albums on my iPod.  How do I get all the songs on that album togeth

    How do I get all the songs from an album to show in the album view?  Currently, if an album lists the artist plus a guest artist, those are shown separately and appear to be two different albums on my iPod.  How do I get all the songs on that album together on my iPod?  If the album is a collaboration wtih many artists, each sond may appear as a separate album.

    I used to have this problem.
    First, you need to go back on iTunes
    you need to go to each of the songs that are having this problem
    Click the album so all the songs drop down
    Right click the songs that have this problem
    Click ' Get info '
    Click the tab that says " info '
    The box that says ' album artist ' should probably be empty (correct me if I'm wrong)
    Click it and type the artist of the entire album, NOT the songs guest artist
    as such,
    ARTIST
    JAY-Z Feat. Justin Timberlake
    ALBUM ARTIST
    JAY-Z
    These should be separate for each artist
    If you write the same album artists for each song by that artist, all the songs should be on 1 album

  • How do I erase all the emails from my iPad in one or two clicks?

    How do I erase all the emails from my iPad in just a few clicks?

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • Premiere Elements 4.0 - How do I change all the clips from 5 seconds to 2 seconds in length?

    Premiere Elements 4.0 - How do I change all the clips from 5 seconds to 2 seconds in length?

    Christine,
    The Duration of Stills is set with Edit>Preferences to the number of Frames required, where ~ 30 Frames = 01 sec. of Duration.
    Unfortunately, the Duration cannot be reset (Edit>Preferences) for material that has already been Imported. The procedure is to Delete those Imported Stills, and make the change, then re-Import them, and you will get the Duration that you have reset.
    The only other option at this point is to manually Click-drag on the Head, or Tail of each Still in the Timeline, to adjust the Duration. I do this with the Info Panel open and visible to make it easier. Personally, unless I am well into the editing process, the Delete, change and re-Import option is my choice.
    Good luck,
    Hunt
    PS - the ability to alter the Duration en masse for Imported Stills in the Project Panel has just been added in PrPro CS5. I do not know if it has been added in PrE 9 though.

  • When creating a book how can I get all the photos from an album to show up in the order they were in the album?

    When creating a book in iphoto, how can I get all the photos from the album I want to use to show up in the order that they are in the album?  When I tried to use the option to add my own photos instead of having the program "flow" them, they showed up all mixed up.

    iPhoto puts them in the book in chronological order.  So to get your photos from an album into an iPhoto book in the same order you will need to use the Photos ➙ Batch Change ➙ Date menu option and set them all to the same date with a 1 minute time difference between each. 
    OT

  • The display on my MacBook Pro from 2007 finally gave out, how do I transfer all the data from the old one onto my new one?

    A week or so ago, the screen on the Macbook Pro I've had for 5 years went permanently black. The screen itself still works, but it's just all black. Went from flickering/flashing to black. I didn't have any kind of warranty on it or anything, and in addition to all of the other things about it that needed fixing, it seemed like it'd just be cheaper to get a new Macbook Pro.
    My question is: How do I get all the stuff from the old laptop to the new laptop without having to use the old laptop's display? Is there a cable I can use to connect the two, and I can just access the old one from the new one?

    FireWire between the two (get appropriate 800-800 or 400-800), Target Disk Mode on the old one, appears as an external disk on the new one. Drag everything over, or use Setup Assistant if first start of new one, or plain old Migration Assistant. You really don't need a display to see a prancing FireWire icon, do you?
    http://support.apple.com/kb/HT1661
    http://support.apple.com/kb/HT4889
    (with the added advantage that since you ain't booting anything off the drive, can turn the Mac on or off at will without risking data corruption on the drive)

  • How can I copy all the comments from my picture/s in fotostream to my picture/s in my library?

    How can I copy all the comments from my picture/s in fotostream to my picture/s in my library?

    Hi, first, you should prevent the iTunes library auto sync with iPhone: Launch iTunes > click Preferences... > click Devices. In the window, check the option 'Prevent iPods, iPhones, and iPads from syncing automatically'. Next, connect your iPhone with your computer via the USB cable. Click the mini menu for iTunes on the very top left and click the option 'Show menu bar'. After then you can see iTunes File, Edit, View, Control, Store and Help menus on the ribbon. Click File > Devices > Transfer purchases from (your iPhone name). You can also access to the File menu by holding down Alt (Option on Mac), Shift and F keys. This is how to get your iPhone purcahsed song transferred to iTunes Library.

  • How to delete the Folder from sql server 2008

    Hi all,
    I was trying to delete the folder from sql server 2008 with the below script
    DECLARE @path VARCHAR(256) -- path for backup files
    DECLARE @cmd VARCHAR(8000)
    DECLARE @folderName VARCHAR(256) -- filename for backup
    SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112))  -- 7 days back date folder name
    SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
    SET @cmd = 'del ' + @path -- Delete
    EXEC master..xp_cmdshell @cmd
    --Print @cmd
    This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.
    Thanks,
    Prasad R.

    I would notice   you that T-SQL does not play well to do things like that. Do not you want using .net language to delete folders?
    Old method is
    declare @HR int, @CFOLDER varchar(255),@FSO int
        set @CFOLDER='D:\folder\'
        EXEC @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
        EXEC @HR = sp_OAMethod @FSO, null, 'DeleteFolder', @CFOLDER 
    Now regarding to your second question please examine xp_fileexist  system stored procedure
    CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
      RETURNS INT
    AS
    BEGIN
      DECLARE @file_exists AS INT
      EXEC master..xp_fileexist @filename, @file_exists OUTPUT
      RETURN @file_exists
    END
    GO
    -- test
    SELECT dbo.fn_file_exists('c:\a.txt')
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

  • How do I put all the songs from a compilation album into the same /album/folder in Itunes v12

    How do I put all the songs from a compilation album into the same /album/folder in Itunes v12 i know in other versions it was via get info but as all of the tunes have the same album title , I am not sure what tio change to achieve this ?

    I don't see your screenshot but I assume you're starting with something like this, i.e., the compilation split into multiple albums:
    If you select all the items that you want to be in a single album, right-click > Get Info you'll see this:
    As you say, in iTunes 12 you don't see a field to enter a distinct Album Artist value.  You can, however, address this by clicking the Add Field button and selecting Album Artist:
    That makes the field available in the metadata dialog so that you can enter the required value:
    You can also show the pre-iTunes 12 version of the dialog by holding the SHIFT key when selecting Get Info - this allows you to enter the Album Artist directly:

  • How can i move all the song from my iPod to my new mac pro laptop?

    how can i move all the song from my ipod touch to my new macbook pro?

    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities
      Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

Maybe you are looking for

  • Net value showing negative in excise billing for free goods items

    Dear All, Need value suggestions in business scenario. While issuing Free goods to customer in excise billing ,Net  value of ZTNN item showing negative Inserted R100 % condition type above Tax condtions. MRP is statistical and accessable value is cal

  • Ultrabeat weirdness - can you replicate this? urgent advice needed

    I am using the kick drum from the default patch in one of my tracks - the weird think is that when i look at the master output channel the right level is hitting about 4 db higher than the left.... is anyone else able to replicate this or better stil

  • My New LP8 File Always Prevents Logic from Opening

    hi guys, i have a minor crisis. heres the short version => a piece i've been working on all of a sudden caused Logic Pro 8 to crash, and when i try and open the crashed version it just causes it to crash again. it won't even open it. i can go to the

  • Oracle Integration suite?

    All, Right now I'm working with TIBCO EAI tool for integrating oracle application with my legacy system. I'm very much interested to know, which Fusion Middleware suite matches the TIBCO integration. Any pointers to the document is highly appreciated

  • My laptop wont switch on

    Hello hope you are all good.. I have been trying to switch on my laptop but it wont, befor it even switch on completely the screen goes black and stays like that.i tried to do system recovery it wont work.the infomation that comes says your pc has ru