Click here to Skip to main content
15,881,581 members
Home / Discussions / Database
   

Database

 
AnswerRe: Data base Size Pin
Krish - KP15-Feb-07 23:40
Krish - KP15-Feb-07 23:40 
Questionfree sql database upload space provider Pin
Ajay R Ojha15-Feb-07 23:03
Ajay R Ojha15-Feb-07 23:03 
Questiondb backup Pin
amilapradeep15-Feb-07 17:11
amilapradeep15-Feb-07 17:11 
AnswerRe: db backup Pin
Colin Angus Mackay15-Feb-07 23:03
Colin Angus Mackay15-Feb-07 23:03 
GeneralRe: db backup Pin
amilapradeep15-Feb-07 23:16
amilapradeep15-Feb-07 23:16 
QuestionClear database contents Pin
Zoltan Balazs15-Feb-07 11:03
Zoltan Balazs15-Feb-07 11:03 
AnswerRe: Clear database contents Pin
-Dr_X-15-Feb-07 11:06
-Dr_X-15-Feb-07 11:06 
AnswerRe: Clear database contents Pin
Member 9615-Feb-07 11:12
Member 9615-Feb-07 11:12 
There are three ways I would approach this:
The cleanest and fastest way if it's a database that contains a lot of data is to issue a drop statement against the entire database. I.E. remove the database completely and then recreate it.
The advantage of this is that it's clean and fast if you have to empty a database that already has a lot of data in it. The disadvantage is that you have to recreate the database from code, but it's usually a good idea to have code do that in any case which makes installations etc easier.

The second way depends on the database server itself many SQL servers have some kind of syntax for quickly emptying tables. In MS SQL server you can use something like "truncate table" (oracle too I think) it will delete much faster because it won't log each row deletion, however it will still respect referential integrity so if you have foreign keys etc you will have to either a) Be careful what order you remove the tables in always removing the ones at the outermost "branches" of the relationships first or b) drop the relationship then recreate it after you've truncated.

The third way is to issue delete statements against tables with the same caveats about referential integrity as the second way, but it's much slower than using truncate table.

In my own software I use the second *and* third way because for the areas that need to clean out the datbase they need to keep some of the data in some of the tables. And I have to support Firebird as well as mssql which doesn't have a truncate table command. If this weren't the case I'd go with option 1 every time, nothing is faster or cleaner than that.
GeneralRe: Clear database contents Pin
Zoltan Balazs15-Feb-07 11:18
Zoltan Balazs15-Feb-07 11:18 
GeneralRe: Clear database contents Pin
Member 9615-Feb-07 11:29
Member 9615-Feb-07 11:29 
GeneralRe: Clear database contents Pin
Zoltan Balazs15-Feb-07 11:33
Zoltan Balazs15-Feb-07 11:33 
GeneralRe: Clear database contents Pin
Member 9615-Feb-07 11:39
Member 9615-Feb-07 11:39 
GeneralRe: Clear database contents Pin
Zoltan Balazs15-Feb-07 11:42
Zoltan Balazs15-Feb-07 11:42 
GeneralRe: Clear database contents Pin
Member 9615-Feb-07 11:47
Member 9615-Feb-07 11:47 
GeneralRe: Clear database contents Pin
Zoltan Balazs15-Feb-07 11:52
Zoltan Balazs15-Feb-07 11:52 
Questionautocomplete using large lookup table Pin
AndrusM15-Feb-07 8:52
AndrusM15-Feb-07 8:52 
AnswerRe: autocomplete using large lookup table Pin
-Dr_X-15-Feb-07 10:55
-Dr_X-15-Feb-07 10:55 
GeneralRe: autocomplete using large lookup table Pin
AndrusM16-Feb-07 3:09
AndrusM16-Feb-07 3:09 
AnswerRe: autocomplete using large lookup table Pin
Keith Worden16-Feb-07 6:08
Keith Worden16-Feb-07 6:08 
GeneralRe: autocomplete using large lookup table Pin
AndrusM16-Feb-07 6:16
AndrusM16-Feb-07 6:16 
GeneralRe: autocomplete using large lookup table Pin
Keith Worden16-Feb-07 6:23
Keith Worden16-Feb-07 6:23 
QuestionTransaction on Dataset in ADO.net Pin
Neeraj_Maurya15-Feb-07 5:37
Neeraj_Maurya15-Feb-07 5:37 
AnswerRe: Transaction on Dataset in ADO.net Pin
Colin Angus Mackay15-Feb-07 13:47
Colin Angus Mackay15-Feb-07 13:47 
Questiongetting data from the DB Pin
minkinin15-Feb-07 2:25
minkinin15-Feb-07 2:25 
AnswerRe: getting data from the DB Pin
Member 9615-Feb-07 11:42
Member 9615-Feb-07 11:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.