> That's not a good idea. When you use find_by_sql, rails will try and
> create a result set array (because it assumes you are doing a select).
> RoyaltyReportFiles.connection.execute allows you to execute arbitrary
> sql, however if you are doing an insert you should use
> RoyaltyReportFiles.connection.insert ( the only difference is
> readability and the fact that insert will flush Rails' query cache
> whereas execute will not).
>
>
> Fred
Hi Fred,
thanks a million. it works...
I write a following code and it works like a magic........
RoyaltyReportFiles.connection.insert("insert into royalty_reports
(artist_name, album_name, product_type, currency, status, upc, isrc,
track_title, revenue, units, file_id, local_revenue) select artist_name,
album_name, product_type, currency, status, upc, isrc, track_title,
revenue, units, file_id, local_revenue
from temp_royalty_reports where id>=336401")
it saves 50 data from temp_royalty_reports to royalty_reports.
Fred i want to know one more thing is it good practise for inserting
thousands of data from one table to another?
waiting for your reply...
Salil
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---