I need to archive an entire set of rows from one table to another, in effect, doing this SQL: INSERT INTO table1 SELECT * FROM table2 WHERE blah... Should I just do bare SQL or is there some "bulk insert" functionality exposed in ActiveRecord for me to use? Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Wes Gamble wrote:> I need to archive an entire set of rows from one table to another, in > effect, doing this SQL: > > INSERT INTO table1 > SELECT * FROM table2 WHERE blah... > > Should I just do bare SQL or is there some "bulk insert" functionality > exposed in ActiveRecord for me to use? > > Thanks, > Wes > > -- > Posted via http://www.ruby-forum.com/.You could extract the table to a fixture, rename it, and load the fixture. _Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Wes Gamble wrote:> I need to archive an entire set of rows from one table to another, in > effect, doing this SQL: > > INSERT INTO table1 > SELECT * FROM table2 WHERE blah... > > Should I just do bare SQL or is there some "bulk insert" functionality > exposed in ActiveRecord for me to use? >This functionality is in ActiveRecord::Extensions, http://blogs.mktec.com/zdennis/pages/ARE however it is NOT released. The current interface setup for this is.. Model.insert_into OtherModel, :conditions=>{ .... } I''m not 100% on the api for it yet, but your thoughts could concrete it or I could implement it in another way. What db are you using right now? Zach -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFPoYBMyx0fW1d8G0RAihuAJ4xTgnWqj12afwfzGERjpV5iddwqACePpeb 54UWD35QDbIOuzyhHgSkHpc=y/O8 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I''m using SQL Server 2000 (gasp!). I think the usage you propose is fine. I can''t think of anything fancy that I''d need for my purposes. Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Wes Gamble wrote:> I''m using SQL Server 2000 (gasp!). > > I think the usage you propose is fine. I can''t think of anything fancy > that I''d need for my purposes.Can you contact me privately at zach.dennis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org and email me a few different INSERT statements that you would hypothetically use, I will make sure I add support for the MSSQL adapter for this functionality. I am going to use http://en.wikipedia.org/wiki/Insert_%28SQL%29 as my guide for conformance. thanks, Zach -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFPo8cMyx0fW1d8G0RAhM3AJ9ZKwxpbK+66CWYgRTGo7GPsJ7/PACfcTUo tUv5xM35fTK19MeqRuU4IfE=vRdD -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---