delete

SQL Output on Cascaded Delete

Is it possible to output values from a cascaded delete in SQL? Something like: DELETE [Families] OUTPUT [deleted].[FamilyID] [deleted].[FamilyName], [Members].[MemberName] FROM [Families] LEFT JOIN [Members] ON [Members].[FamilyID] = [Families].[FamilyID] If there were two families with three total members, it sho...

Update: using sql to keep only a single record where both name field and address field repeat in 5+ records - Microsoft Access

Hey all, I am trying to delete all but one record from table where name field repeats same value more than 5 times and the address field repeats more than five times for a table. So if there are 5 records with a name field and address field that are the same for all 5, then I would like to delete 4 out of 5. An example: id name address...

multiple C++ deletion of a memory pointed by multiple objects

Another c++ pointer deletion question is in the following example: class Foo { public: int *p; ~Foo() { delete p; p = NULL; } }; Foo *f1 = new Foo(); Foo *f2 = new Foo(); f1->p = new int(1); f2->p = f1->p; delete f2; // ok delete f1; // no error? Why I did not get error when calling "delete f1"? didn't I delete th...

Can dropping and recreating an index speed up a SQL delete?

I'm performing some large date-based delete queries on tables with indexes on fields other than date. I've been told that dropping those indexes, performing the delete, and then re-building the index could be faster than just running the delete against the indexed table. Is this the case? I can see why the actual removing of records wou...

default_scope breaks (update|delete|destroy)_all in some cases

Hello, I believe this is a bug in Rails 3. I am hoping someone here can steer me in the correct direction. The code posted below, is purely for illustration of this problem. Hopefully this does not confuse the issue. Given I have a Post model, and a Comment model. Post has_many Comments, and Comment belongs_to Post. With a default_scop...

Can Upsert be more effective if we have more data ?

Hi, I have to delete some amnt of data and insert some into same table. Will there be any performance improvement if we go for Upsert in a loop ? Thanks in advance! ...

Correct time to delete persistent store to delete all entries of an entity

Hi, I am using an UITableViewController containing a UITableView and an UISearchTableView. The table lists e.g. 1000 entries. I want to provide the user a button to delete all entries of a specific entity. Because looping over all managed objects and saving the context takes a very long time, I thought of deleting by removing the persi...

PHP MySql query to delete rows doesn't work.

I have this php script: foreach (get_all_topics () as $topic_id => $topic_info) { $result = mysql_query("DELETE FROM marks WHERE user_id = $user_id AND topic_id = $topic_id", $db); echo "DELETE FROM marks WHERE user_id = $user_id AND topic_id = $to...

delete expression

Reference here That destructor will also implicitly call the destructor of the auto_ptr object. And that will delete the pointer it holds, that points to the C object - without knowing the definition of C! That appeared in the .cpp file where struct A's constructor is defined. This was curious and then 5.3.5/5 sta...

Object-Oriented Suicide or delete this;

The following code compiled with MSVC9.0 runs and outputs Destructor four times, which is logical. #include <iostream> class SomeClass { public: void CommitSuicide() { delete this; } void Reincarnate() { this->~SomeClass(); new (this) SomeClass; } ~SomeClass() { std::cout << "Destructor\n...

Asp.Net MVC: Can't delete Cookies that I get after Facebook Connect

I implemented Facebook-Connect successfully and Im able to retrieve User-Information using the Facebook Toolkit. But I cant sucessfully logout. When I press the facebook-Logout button (which automatically appears when Im logged in, because im using the autologoutlink-property) <fb:login-button autologoutlink="true"></fb:login-button> ...

Delete all files in a directory w/o subdirectories with Apache Ant

I need an Apache Ant target that deletes all files in a directory but does not touch subdirectories. In my current approach I have to explicitly name the subdirectories I want to skip (atm just "src/"). <delete> <fileset dir="${dist.dir}" excludes="src/" /> </delete> But I don't like it. That way I would have to modify the target ...

Rails 3 nested forms with has_many :through, entry in join table dosen't get deleted after update

Hi, i have a 'User' model which has a has_many relationship to a 'Number' model through a join table 'user_number' model. I use accepts_nested_attributes_for :numbers, :allow_destroy => true in the 'User' model. Everything works fine except that whenever i delete a number from a user in the edit form, the associated number is deleted ...

How to optimize slow delete query (delete data which is not used in another table) in Postgresql

I have 2 tables (name(fields)): data(object_id, property_id, value_id) and string(id, value) All the data is in "string" table. "data" only refers to corresponding strings. For example, I have: data(1,2,3) data(1,4,5) data(6,4,7) string(1, 'car') string(2, 'color') string(3, 'red') string(4, 'make') string(5, 'audi') string(6, '...

Delete all record exist in all table.

Hello there, How to make query in sql to delete all record exist in every table. There possible to write every name table using command delete. But it will take long time to write every single name table. I am already try DELETE FROM * in MySQL but it got error: You have an error in your SQL syntax; check the manual that correspond...

How to delete all events from calendar?

Is there a method to receive all entries from calendar at once, without specifying predicate, which can only create 5 years intervals? I know about "5 years" from console output. I specified 1912-2020 years and here is output: EKEventPredicate start:1/1/12 12:00 AM; end:1/1/16 12:00 AM; cals:(null) Here is my current code: EKEventStor...

JavaScript Confirm boxes with custom buttons

can i write custom confirm box in javascript.Instead of 'OK' and 'CANCEL' buttons i want to show 'SAVE' and 'DELETE' buttons. ...

NHibernate Delete with date arithmatic using HQL

Hello, I've looked around and can't find too much. But is it possible to do something like this using HQL in nHibernate: Session.CreateQuery(@"DELETE FROM MyObject mo WHERE (mo.AlteredDate + mo.ExpiryDetails.ExpiryTimestamp) < :pNow") .SetDateTime("pNow", DateTime.Now); So basically I want to...

A batch file to download and delete files from a server

Hi, How can i write a MS dos ftp batch file to: download files from the server to my local pc remove these files from the server after download cheers! Edit ok so far i have... Batch file: ftp.exe -s:ftp.txt FTP.txt: open domain.com usernamehere passwordhere cd /httpdocs/store/files need get, list an...

How to do a fast DELETE of lots of data from a large table (sql server)

I want to delete about 90% of rows from a million+ row table. Anything I can do to make this faster? e.g. if I turn on Simple Recovery Mode will this help? ...