Fastest way to dump a table contents?

This is a discussion on "Fastest way to dump a table contents?" within the Databases section. This forum, and the thread "Fastest way to dump a table contents? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 27th, 2004, 09:54
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Fastest way to dump a table contents?

Anyone know what the fastest way to dump the contents of a MsSql table is?

I am currently using : DELETE * FROM table
...which is a bit slow. Is there a faster way?

u2o

  #2 (permalink)  
Old Feb 27th, 2004, 12:20
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
In MySQL you can use:
DELETE FROM `table` ;

which instantly removes the whole lot... I'm not sure if it's the same thing... I suppose technically it is, but I can't see a faster way... other than perhaps dumping the table and recreating it?
  #3 (permalink)  
Old Feb 27th, 2004, 12:28
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Oops, got my syntax wrong. It is the same, DELETE FROM 'table'

u2o
  #4 (permalink)  
Old Mar 1st, 2004, 01:10
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
well, in MSSQL there's TRUNCATE TABLE blah

It looks like MySQL has an implementation of it too:
http://www.mysql.com/doc/en/TRUNCATE.html

MUCH faster than DELETE FROM
  #5 (permalink)  
Old Mar 1st, 2004, 08:36
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Spot on Catalyst!!! That is *exactly* what is was looking for.

Virtual beer or the way!

u2o
  #6 (permalink)  
Old Mar 1st, 2004, 10:03
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Personally I would load all the records into an array, use VBScript to sort them all alphabetically removing any duplicates.

I would then check the consistency of each record, making sure I escape any non displayable characters.

Then, update the database.

Next, do another select and loop through each record deleting it one by one.

LMAO!!! [:P)

PS:- only do this if you want to pass the time it takes the kettle to boil.


Seriously, I think the truncate is the best way!
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #7 (permalink)  
Old Mar 1st, 2004, 20:43
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
LOL and cheers
Closed Thread

Tags
fastest, dump, table, contents

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] foreach problem -- table of contents script MikeHopley PHP Forum 1 Apr 4th, 2008 11:51
fastest way to check if table exists CloudedVision PHP Forum 3 Feb 20th, 2008 16:15
Dump actual header alexgeek PHP Forum 6 Jan 23rd, 2008 14:54
Viewing the contents of a table in MySQL nemmea Databases 3 Sep 6th, 2007 22:01
The Best and Fastest Method For Rounded Corner Designs sinjix_media Web Page Design 1 Jun 7th, 2007 15:38


All times are GMT. The time now is 06:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43