Hi,
Anyone can help, to my script see the list below. I want to insert from
MySqlDB to SqlServerDB. Currently, my script will insert the entire data
but I need to truncate the table first from SqlServerDB on ISQL command
line manually.
Is there a way directly to insert the data without truncating the table
mytalbes on SqlServerDB?
# Start Here
# rake utils:staging
n# rake utils:staging
namespace :utils do
task :staging => :environment do
FileList.new(''app/**/*'') { |list|
translations = []
list.each { |file_path|
unless File::directory?(file_path)
file = File.open(file_path, ''r'')
file.each { |line|
translations = translations |
line.scan(/[\''\"]([^\''\"]+)[\''\"]\.t/)
}
file.close
end
}
# MySqlDB Unix getting the data here
ActiveRecord::Base.establish_connection(:development)
mytables = Mytable.find :all
# SqlServerDB Windows insert the data not existing on MysqlDB
Unix
ActiveRecord::Base.establish_connection(:production)
mytables.each { |mytable| Mytable.create mytable.attributes }
}
end
end
# End Here
Thanks in Advance!
--
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?hl=en
-~----------~----~----~----~------~----~------~--~---