Hmmm, I don't know anything about isql, but two possibilities stand
If this is a once-in-a-while administrative task, you could create a
rake task (I really like this tutorial for that:
On the other hand, you could create a script in lib and bootstrap
rails to it. The template code I've been using to get the rails
environment ready is:
# Ensure the environment was specified
if ARGV.length != 1
puts "usage: ruby file_name.rb <rails_env>"
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV']
require File.dirname(__FILE__) + '/../config/boot'
conf = YAML::load(File.open(File.dirname(__FILE__) + '/../config/
# Open ActiveRecord connection
At this point, you've got Rails running. You'll want to have included
any libraries necessary to use isql. Then, you're just writing ruby
code between isql and rails.