you missed some points:
at first, this is not the whole script, just a single line, but that is not enough there should be several additional lines.
second, isql is waiting for something on stdin (that is the function of pipe), in your second example it is completely missing.
about <<exit, it is the so called here document: http://www.tldp.org/LDP/abs/html/here-docs.html
so there should be another line containing the word exit only...