Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = File.open("telephone_ids.txt", "r")
- soctypeid = "42"
- delete_output = "delete from telephonesoctypeoverride
- where soctypeid=" + soctypeid + " and telephoneid in ("
- insert_output = "insert into telephonesoctypeoverride
- (soctypeid, socoption, telephoneid) values "
- sync_output = "update telephonecellular
- set syncneeded = \'1\' where telephoneid in ("
- f.each_line do |line|
- delete_output << line.chomp + ","
- insert_output << "('" + soctypeid + "','Remove','" + line.chomp + "'),"
- sync_output << line.chomp + ","
- end
- delete_output = delete_output.chop
- delete_output << ");\n"
- insert_output = insert_output.chop
- insert_output << ";\n"
- sync_output = sync_output.chop
- sync_output << ");\n"
- f.close
- File.open("sql.sql", 'w') { |file| file.write(delete_output + insert_output + sync_output) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement